Consider the following,

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Text_Display.H>
static Fl_Text_Display::Style_Table_Entry stable[] = {
  {  FL_RED,         FL_COURIER, 18 },
  {  FL_BLUE,        FL_COURIER, 18 },
};
int main() {
int lW = 640; int lH = 480;
  while (lW < 700)
  {
    Fl_Window *win = new Fl_Window(lW, lH, "Header");
    Fl_Text_Display *disp = new Fl_Text_Display(20, 20, lW-40, lH-40);
    Fl_Text_Buffer *tbuff = new Fl_Text_Buffer();
    Fl_Text_Buffer *sbuff = new Fl_Text_Buffer();
printf("\nwin = %p disp = %p tbuff = %p sbuff = %p",win,disp,tbuff,sbuff);
    disp->buffer(tbuff);
    int stable_size = sizeof(stable)/sizeof(stable[0]);
    disp->highlight_data(sbuff, stable, stable_size, 'A', 0, 0);
    tbuff->text("Red Line 1\nBlu Line 2\n");
    sbuff->text("AAAAAAAAAA\nBBBBBBBBBB\n");
    win->end();
    win->show();
printf("...Run...\n");
    Fl::run();
//    disp->buffer(NULL);
printf("Deleting sbuff..."); delete sbuff;
printf("Deleting tbuff..."); delete tbuff;
printf("Deleting disp..."); delete disp;
printf("Deleting win..."); delete win; printf("DONE\n");
                lW += 20; lH += 20;
  }
printf("\n");
  return(0);
}

Just run this pressing ESCAPE 3 times. Observe the output

win = 0x93f0008 disp = 0x93f00b0 tbuff = 0x93f0350 sbuff = 0x93f07c0...Run...
Fl_Text_Buffer::remove_modify_callback(): Can't find modify CB to remove
Fl_Text_Buffer::remove_predelete_callback(): Can't find pre-delete CB to remove
Deleting sbuff...Deleting tbuff...Deleting disp...Deleting win...DONE

win = 0x93f0008 disp = 0x93f00b0 tbuff = 0x93f07c0 sbuff = 0x93f0350...Run...
Fl_Text_Buffer::remove_modify_callback(): Can't find modify CB to remove
Fl_Text_Buffer::remove_predelete_callback(): Can't find pre-delete CB to remove
Deleting sbuff...Deleting tbuff...Deleting disp...Deleting win...DONE

win = 0x947c308 disp = 0x947c3b0 tbuff = 0x93f0350 sbuff = 0x93f07c0...Run...
Fl_Text_Buffer::remove_modify_callback(): Can't find modify CB to remove
Fl_Text_Buffer::remove_predelete_callback(): Can't find pre-delete CB to remove
Deleting sbuff...Deleting tbuff...Deleting disp...Deleting win...DONE

Some Questions , First if you UNcomment  disp->buffer(NULL),
the 2 lines below disappear.
Fl_Text_Buffer::remove_modify_callback(): Can't find modify CB to remove
Fl_Text_Buffer::remove_predelete_callback(): Can't find pre-delete CB to remove

Why is this so? Why SHOULD this be so?

Secondly, each example that I have seen has ONLY 1 window(++...).
This code makes a window(++widgets) appear AND disappear.
I would assume that it should clean up after itself CLEANLY (memory wise).

It seems to me theoretically that each

win = 0x93f0008 disp = 0x93f00b0 tbuff = 0x93f0350 sbuff = 0x93f07c0...Run...
win = 0x93f0008 disp = 0x93f00b0 tbuff = 0x93f07c0 sbuff = 0x93f0350...Run...
win = 0x947c308 disp = 0x947c3b0 tbuff = 0x93f0350 sbuff = 0x93f07c0...Run...

should have the SAME VALUES.

Note this is just one PARTICULAR example of (Widget pollenation).
Has every widget been checked for memory leakage/fragmentation ? Automatically.

Perhaps there is something I have missed.

Also I see 1.3.1 is being touted for release.
I STR'd Background colors in Fl_Text_Text_display + Underscore/Strike-thru 
recently.
I know this is only one small part but I was wondering about the ABI breakage 
testing
and/or inclusion results ?





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

Reply via email to