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

[STR New]

Link: http://www.fltk.org/str.php?L2780
Version: 1.3-feature


When trying to to closing all remaining windows after the main window is
closed using a timeout function like this:
---
void delete_all_windows(void *ud) {
  for(Fl_Window *win=Fl::first_window(); win; win=Fl::next_window(win)){
    Fl::delete_widget(win);
  }
}
---
The application crash because they are attempting to delete already
deleted windows, I do call Fl::delete_widget from destructor of other
windows too.

The simple patch attached solve the problem by checking if a window is
already on the queue and returning without duplicating it.


Link: http://www.fltk.org/str.php?L2780
Version: 1.3-feature
Index: Fl.cxx
===================================================================
--- Fl.cxx      (revision 9186)
+++ Fl.cxx      (working copy)
@@ -1736,6 +1736,10 @@
 void Fl::delete_widget(Fl_Widget *wi) {
   if (!wi) return;
 
+  for (int i = 0; i < num_dwidgets; i ++){
+    if(dwidgets[i] == wi) return; //already on queue
+  }
+
   if (num_dwidgets >= alloc_dwidgets) {
     Fl_Widget  **temp;
 
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to