the docs say about fltk::Browser "... if no callback has been set on
the item, the callback() of this widget is called with the user_data()
of the item." however this is not true, it gets passed null. If it was
true, the following program would not segfault. (i'm using r5864)

#include <fltk/Window.h>
#include <fltk/Browser.h>
#include <fltk/run.h>
#include <fltk/ask.h>
using namespace fltk;

int randomglobalvariable = 4;

void browser_cb(Widget* w, void* d) {
  *((int*)d) = 5;
  message("wont get here: %d",randomglobalvariable);
}


int main(int argc, char** argv) {
  Window* w = new Window(100,100);
  w->begin();
  Browser* b = new Browser(0,0,100,100);
  b->add("test",&randomglobalvariable);
  b->add("test",&randomglobalvariable);
  b->callback(browser_cb);
  w->end();
  w->resizable(w);
  w->show(1,argv);
  return run();
}

Oh, and r5917 doesnt work at all for me, anything beyond a window with
nothing in it crashes.

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to