summaryrefslogtreecommitdiff
path: root/body/c_fl_widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'body/c_fl_widget.cpp')
-rw-r--r--body/c_fl_widget.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/body/c_fl_widget.cpp b/body/c_fl_widget.cpp
index d226305..4ac39ed 100644
--- a/body/c_fl_widget.cpp
+++ b/body/c_fl_widget.cpp
@@ -7,6 +7,7 @@
#include <FL/Fl_Widget.H>
#include <FL/Fl_Image.H>
#include "c_fl_widget.h"
+#include "c_fl.h"
@@ -65,7 +66,11 @@ WIDGET new_fl_widget(int x, int y, int w, int h, char* label) {
}
void free_fl_widget(WIDGET w) {
- delete static_cast<My_Widget*>(w);
+ if (fl_inside_callback) {
+ fl_delete_widget(w);
+ } else {
+ delete static_cast<My_Widget*>(w);
+ }
}