Author: matt
Date: 2012-08-16 13:59:36 -0700 (Thu, 16 Aug 2012)
New Revision: 9666
Log:
STR 2730: avoid putting widgets into the delete list twice

Modified:
   branches/branch-1.3/src/Fl.cxx

Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx      2012-08-14 09:23:22 UTC (rev 9665)
+++ branches/branch-1.3/src/Fl.cxx      2012-08-16 20:59:36 UTC (rev 9666)
@@ -1707,14 +1707,17 @@
 //#elif defined(__APPLE__)
 #endif
 
+
 //
 // The following methods allow callbacks to schedule the deletion of
 // widgets at "safe" times.
 //
 
+
 static int             num_dwidgets = 0, alloc_dwidgets = 0;
 static Fl_Widget       **dwidgets = 0;
 
+
 /**
   Schedules a widget for deletion at the next call to the event loop.
   Use this method to delete a widget inside a callback function.
@@ -1737,6 +1740,11 @@
 */
 void Fl::delete_widget(Fl_Widget *wi) {
   if (!wi) return;
+  
+  // don;t add the same widget twice
+  for (int i = 0; i < num_dwidgets; i++) {
+    if (dwidgets[i]==wi) return;
+  }
 
   if (num_dwidgets >= alloc_dwidgets) {
     Fl_Widget  **temp;
@@ -1755,6 +1763,7 @@
   num_dwidgets ++;
 }
 
+
 /**
     Deletes widgets previously scheduled for deletion.
 
@@ -1775,10 +1784,12 @@
   num_dwidgets = 0;
 }
 
+
 static Fl_Widget ***widget_watch = 0;
 static int num_widget_watch = 0;
 static int max_widget_watch = 0;
 
+
 /**
   Adds a widget pointer to the widget watch list.
 
@@ -1843,6 +1854,7 @@
 #endif // DEBUG_WATCH
 }
 
+
 /**
   Releases a widget pointer from the watch list.
 
@@ -1876,6 +1888,8 @@
 #endif // DEBUG_WATCH
   return;
 }
+
+
 /**
   Clears a widget pointer \e in the watch list.
 

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

Reply via email to