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

[STR New]

Link: http://www.fltk.org/str.php?L2055
Version: 2.0-current


Unlike Input, TextEditor does not reset fl_pending_callback in it's
destructor wich can cause
crashes after deletion of an TextEditor object.
Attached patch resets fl_pending_callback as it is done in the Input
destructor.


Link: http://www.fltk.org/str.php?L2055
Version: 2.0-current
diff -r f4f8b1cb4b0b src/TextEditor.cxx
--- a/src/TextEditor.cxx        Thu Oct 02 16:11:29 2008 +0200
+++ b/src/TextEditor.cxx        Thu Oct 02 21:37:07 2008 +0200
@@ -53,7 +53,11 @@ TextEditor::TextEditor(int X, int Y, int
   default_key_function(kf_default);
 }
 
-TextEditor::~TextEditor() { remove_all_key_bindings(); }
+extern Widget* fl_pending_callback;
+TextEditor::~TextEditor() {
+  if (fl_pending_callback == this) fl_pending_callback = 0;
+  remove_all_key_bindings();
+}
 
 TextEditor::Key_Binding* TextEditor::global_key_bindings = 0;
 
@@ -416,8 +420,6 @@ int TextEditor::handle_key() {
   return 0;
 }
 
-extern Widget* fl_pending_callback;
-
 // Called by any changes to the text, this correctly triggers callbacks:
 void TextEditor::maybe_do_callback() {
   set_changed();
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to