DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Active]

Link: http://www.fltk.org/str.php?L2635
Version: 1.3-feature
Fix Version: 1.3.0


Surprise, surprise ;-)

The proposed patch was not sufficient, since we have two definitions of
fl_xid() depending on the macro FL_INTERNALS and/or FL_LIBRARY.

See attached file fl_xid.cxx for a working test case.

I'm going to fix this now and will commit the changes...


Link: http://www.fltk.org/str.php?L2635
Version: 1.3-feature
Fix Version: 1.3.0
/*
  fl_xid() test program (STR #2635)
  This program *must* run correctly w/o a crash (segmentation fault)
  on all platforms. Watch the output after closing the main window,
  this is expected to output "NULL" as the function value.

  Note: you should run two tests, one with the following macro
  FL_INTERNALS defined and one w/o it. Both must succeed.

  Example for a successful run:

$ ../fltk-config --compile fl_xid.cxx && ./fl_xid
...
Line 45: fl_xid(00382ED0) = NULL
Line 52: fl_xid(00382ED0) = NULL
Line 54: fl_xid(00382ED0) = 359F0750
Line 56: fl_xid(00382ED0) = NULL

  Note that the last line appears after closing the window.

*/

// #define FL_INTERNALS

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

#include <FL/x.H>
#include <stdio.h>

void test (int line, Fl_Window *w) {
  printf ("Line %d: fl_xid(%p) = ",line,w);
  fflush(stdout);
  void *xid = (void *)fl_xid(w);
  if (xid)
    printf ("%p\n",xid);
  else
    printf ("NULL\n");
  fflush(stdout);
}

int main(int argc, char **argv) {
  Fl_Window *window = new Fl_Window(340,180);
  test(__LINE__,window);        // ** this will crash **
  Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
  box->box(FL_UP_BOX);
  box->labelfont(FL_BOLD+FL_ITALIC);
  box->labelsize(36);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  test(__LINE__,window);        // ** this will crash  **
  window->show(argc, argv);
  test(__LINE__,window);        // this is okay
  int ret = Fl::run();
  test(__LINE__,window);        // ** this will crash **
  return ret;
}
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to