summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-02-06 21:55:19 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-02-06 21:55:19 +1300
commitee967448bae4733aec70ba128062bc3357a2f0df (patch)
treec6f2fb273132be93a1a067bec854fa13923ea792
parent547e538476a788dfeb5974f9b8ad29441d18980b (diff)
Widget deletion inside callbacks is now safeHEADmaster
-rw-r--r--body/c_fl.cpp42
-rw-r--r--body/c_fl.h9
-rw-r--r--body/c_fl_adjuster.cpp7
-rw-r--r--body/c_fl_box.cpp7
-rw-r--r--body/c_fl_browser.cpp7
-rw-r--r--body/c_fl_browser_.cpp7
-rw-r--r--body/c_fl_button.cpp7
-rw-r--r--body/c_fl_cairo_window.cpp7
-rw-r--r--body/c_fl_chart.cpp7
-rw-r--r--body/c_fl_check_browser.cpp7
-rw-r--r--body/c_fl_check_button.cpp7
-rw-r--r--body/c_fl_choice.cpp7
-rw-r--r--body/c_fl_clock.cpp7
-rw-r--r--body/c_fl_clock_output.cpp7
-rw-r--r--body/c_fl_color_chooser.cpp7
-rw-r--r--body/c_fl_counter.cpp7
-rw-r--r--body/c_fl_dial.cpp7
-rw-r--r--body/c_fl_double_window.cpp7
-rw-r--r--body/c_fl_file_browser.cpp7
-rw-r--r--body/c_fl_file_input.cpp7
-rw-r--r--body/c_fl_fill_dial.cpp7
-rw-r--r--body/c_fl_fill_slider.cpp7
-rw-r--r--body/c_fl_float_input.cpp7
-rw-r--r--body/c_fl_gl_window.cpp7
-rw-r--r--body/c_fl_group.cpp7
-rw-r--r--body/c_fl_help_view.cpp7
-rw-r--r--body/c_fl_hold_browser.cpp7
-rw-r--r--body/c_fl_hor_fill_slider.cpp7
-rw-r--r--body/c_fl_hor_nice_slider.cpp7
-rw-r--r--body/c_fl_hor_value_slider.cpp7
-rw-r--r--body/c_fl_horizontal_slider.cpp7
-rw-r--r--body/c_fl_input.cpp7
-rw-r--r--body/c_fl_input_.cpp7
-rw-r--r--body/c_fl_input_choice.cpp7
-rw-r--r--body/c_fl_int_input.cpp7
-rw-r--r--body/c_fl_light_button.cpp7
-rw-r--r--body/c_fl_line_dial.cpp7
-rw-r--r--body/c_fl_menu.cpp7
-rw-r--r--body/c_fl_menu_bar.cpp7
-rw-r--r--body/c_fl_menu_button.cpp7
-rw-r--r--body/c_fl_menu_window.cpp7
-rw-r--r--body/c_fl_multi_browser.cpp7
-rw-r--r--body/c_fl_multiline_input.cpp7
-rw-r--r--body/c_fl_multiline_output.cpp7
-rw-r--r--body/c_fl_nice_slider.cpp7
-rw-r--r--body/c_fl_output.cpp7
-rw-r--r--body/c_fl_overlay_window.cpp7
-rw-r--r--body/c_fl_pack.cpp7
-rw-r--r--body/c_fl_positioner.cpp7
-rw-r--r--body/c_fl_progress.cpp7
-rw-r--r--body/c_fl_radio_button.cpp7
-rw-r--r--body/c_fl_radio_light_button.cpp7
-rw-r--r--body/c_fl_radio_round_button.cpp7
-rw-r--r--body/c_fl_repeat_button.cpp7
-rw-r--r--body/c_fl_return_button.cpp7
-rw-r--r--body/c_fl_roller.cpp7
-rw-r--r--body/c_fl_round_button.cpp7
-rw-r--r--body/c_fl_round_clock.cpp7
-rw-r--r--body/c_fl_scroll.cpp7
-rw-r--r--body/c_fl_scrollbar.cpp7
-rw-r--r--body/c_fl_secret_input.cpp7
-rw-r--r--body/c_fl_select_browser.cpp7
-rw-r--r--body/c_fl_simple_counter.cpp7
-rw-r--r--body/c_fl_single_window.cpp7
-rw-r--r--body/c_fl_slider.cpp7
-rw-r--r--body/c_fl_spinner.cpp7
-rw-r--r--body/c_fl_sys_menu_bar.cpp7
-rw-r--r--body/c_fl_table.cpp7
-rw-r--r--body/c_fl_table_row.cpp7
-rw-r--r--body/c_fl_tabs.cpp7
-rw-r--r--body/c_fl_text_display.cpp7
-rw-r--r--body/c_fl_text_editor.cpp7
-rw-r--r--body/c_fl_tile.cpp7
-rw-r--r--body/c_fl_toggle_button.cpp7
-rw-r--r--body/c_fl_valuator.cpp7
-rw-r--r--body/c_fl_value_input.cpp7
-rw-r--r--body/c_fl_value_output.cpp7
-rw-r--r--body/c_fl_value_slider.cpp7
-rw-r--r--body/c_fl_widget.cpp7
-rw-r--r--body/c_fl_window.cpp7
-rw-r--r--body/c_fl_wizard.cpp7
-rw-r--r--body/fltk.adb6
-rw-r--r--doc/fl.html2
-rw-r--r--spec/fltk.ads2
84 files changed, 523 insertions, 91 deletions
diff --git a/body/c_fl.cpp b/body/c_fl.cpp
index a9e6d16..24119a6 100644
--- a/body/c_fl.cpp
+++ b/body/c_fl.cpp
@@ -6,6 +6,7 @@
#include <FL/Enumerations.H>
#include <FL/Fl.H>
+#include <FL/Fl_Widget.H>
#include "c_fl.h"
@@ -115,24 +116,53 @@ void fl_redraw() {
+short fl_inside_callback = 0;
+
+void fl_delete_widget(void * w) {
+ Fl::delete_widget(static_cast<Fl_Widget*>(w));
+}
+
+
+
+
int fl_check() {
- return Fl::check();
+ short temp = fl_inside_callback;
+ fl_inside_callback = 1;
+ int ret = Fl::check();
+ fl_inside_callback = temp;
+ return ret;
}
int fl_ready() {
- return Fl::ready();
+ short temp = fl_inside_callback;
+ fl_inside_callback = 1;
+ int ret = Fl::ready();
+ fl_inside_callback = temp;
+ return ret;
}
int fl_wait() {
- return Fl::wait();
+ short temp = fl_inside_callback;
+ fl_inside_callback = 1;
+ int ret = Fl::wait();
+ fl_inside_callback = temp;
+ return ret;
}
-int fl_wait2(double s) {
- return Fl::wait(s);
+double fl_wait2(double s) {
+ short temp = fl_inside_callback;
+ fl_inside_callback = 1;
+ double ret = Fl::wait(s);
+ fl_inside_callback = temp;
+ return ret;
}
int fl_run() {
- return Fl::run();
+ short temp = fl_inside_callback;
+ fl_inside_callback = 1;
+ int ret = Fl::run();
+ fl_inside_callback = temp;
+ return ret;
}
diff --git a/body/c_fl.h b/body/c_fl.h
index 51dbedb..b12f560 100644
--- a/body/c_fl.h
+++ b/body/c_fl.h
@@ -8,6 +8,9 @@
#define FL_GUARD
+#include <cstddef>
+
+
extern "C" const short fl_align_center;
extern "C" const short fl_align_top;
extern "C" const short fl_align_bottom;
@@ -61,10 +64,14 @@ extern "C" void fl_flush();
extern "C" void fl_redraw();
+extern "C" short fl_inside_callback;
+extern "C" void fl_delete_widget(void * w);
+
+
extern "C" int fl_check();
extern "C" int fl_ready();
extern "C" int fl_wait();
-extern "C" int fl_wait2(double s);
+extern "C" double fl_wait2(double s);
extern "C" int fl_run();
diff --git a/body/c_fl_adjuster.cpp b/body/c_fl_adjuster.cpp
index 37a52cd..5550250 100644
--- a/body/c_fl_adjuster.cpp
+++ b/body/c_fl_adjuster.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Adjuster.H>
#include "c_fl_adjuster.h"
+#include "c_fl.h"
@@ -67,7 +68,11 @@ ADJUSTER new_fl_adjuster(int x, int y, int w, int h, char* label) {
}
void free_fl_adjuster(ADJUSTER a) {
- delete static_cast<My_Adjuster*>(a);
+ if (fl_inside_callback) {
+ fl_delete_widget(a);
+ } else {
+ delete static_cast<My_Adjuster*>(a);
+ }
}
diff --git a/body/c_fl_box.cpp b/body/c_fl_box.cpp
index e9c170d..8bedec1 100644
--- a/body/c_fl_box.cpp
+++ b/body/c_fl_box.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Box.H>
#include "c_fl_box.h"
+#include "c_fl.h"
@@ -55,7 +56,11 @@ BOX new_fl_box2(int k, int x, int y, int w, int h, char * label) {
}
void free_fl_box(BOX b) {
- delete static_cast<My_Box*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Box*>(b);
+ }
}
diff --git a/body/c_fl_browser.cpp b/body/c_fl_browser.cpp
index bf700b7..b76c496 100644
--- a/body/c_fl_browser.cpp
+++ b/body/c_fl_browser.cpp
@@ -7,6 +7,7 @@
#include <FL/Fl_Browser.H>
#include <FL/Fl_Image.H>
#include "c_fl_browser.h"
+#include "c_fl.h"
@@ -183,7 +184,11 @@ BROWSER new_fl_browser(int x, int y, int w, int h, char * label) {
}
void free_fl_browser(BROWSER b) {
- delete static_cast<My_Browser*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Browser*>(b);
+ }
}
diff --git a/body/c_fl_browser_.cpp b/body/c_fl_browser_.cpp
index 58eaa3d..df65818 100644
--- a/body/c_fl_browser_.cpp
+++ b/body/c_fl_browser_.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Browser_.H>
#include "c_fl_browser_.h"
+#include "c_fl.h"
@@ -190,7 +191,11 @@ ABSTRACTBROWSER new_fl_abstract_browser(int x, int y, int w, int h, char * label
}
void free_fl_abstract_browser(ABSTRACTBROWSER b) {
- delete static_cast<My_Browser_*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Browser_*>(b);
+ }
}
diff --git a/body/c_fl_button.cpp b/body/c_fl_button.cpp
index 409b190..df87ecc 100644
--- a/body/c_fl_button.cpp
+++ b/body/c_fl_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Button.H>
#include "c_fl_button.h"
+#include "c_fl.h"
@@ -75,7 +76,11 @@ BUTTON new_fl_button(int x, int y, int w, int h, char* label) {
}
void free_fl_button(BUTTON b) {
- delete static_cast<My_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Button*>(b);
+ }
}
diff --git a/body/c_fl_cairo_window.cpp b/body/c_fl_cairo_window.cpp
index 4bf75f0..b4891c6 100644
--- a/body/c_fl_cairo_window.cpp
+++ b/body/c_fl_cairo_window.cpp
@@ -7,6 +7,7 @@
#include <FL/Fl_Cairo_Window.H>
#include <FL/Fl_Double_Window.H>
#include "c_fl_cairo_window.h"
+#include "c_fl.h"
@@ -61,7 +62,11 @@ CAIROWINDOW new_fl_cairo_window(int w, int h) {
}
void free_fl_cairo_window(CAIROWINDOW w) {
- delete static_cast<My_Cairo_Window*>(w);
+ if (fl_inside_callback) {
+ fl_delete_widget(w);
+ } else {
+ delete static_cast<My_Cairo_Window*>(w);
+ }
}
diff --git a/body/c_fl_chart.cpp b/body/c_fl_chart.cpp
index c065327..351841f 100644
--- a/body/c_fl_chart.cpp
+++ b/body/c_fl_chart.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Chart.H>
#include "c_fl_chart.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ CHART new_fl_chart(int x, int y, int w, int h, char* label) {
}
void free_fl_chart(CHART b) {
- delete static_cast<My_Chart*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Chart*>(b);
+ }
}
diff --git a/body/c_fl_check_browser.cpp b/body/c_fl_check_browser.cpp
index 947dc63..11fafa4 100644
--- a/body/c_fl_check_browser.cpp
+++ b/body/c_fl_check_browser.cpp
@@ -7,6 +7,7 @@
#include <FL/Fl_Check_Browser.H>
#include <FL/Fl_Browser_.H>
#include "c_fl_check_browser.h"
+#include "c_fl.h"
@@ -197,7 +198,11 @@ CHECKBROWSER new_fl_check_browser(int x, int y, int w, int h, char * label) {
}
void free_fl_check_browser(CHECKBROWSER c) {
- delete static_cast<My_Check_Browser*>(c);
+ if (fl_inside_callback) {
+ fl_delete_widget(c);
+ } else {
+ delete static_cast<My_Check_Browser*>(c);
+ }
}
diff --git a/body/c_fl_check_button.cpp b/body/c_fl_check_button.cpp
index 8dab449..b12bf68 100644
--- a/body/c_fl_check_button.cpp
+++ b/body/c_fl_check_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Check_Button.H>
#include "c_fl_check_button.h"
+#include "c_fl.h"
@@ -66,7 +67,11 @@ CHECKBUTTON new_fl_check_button(int x, int y, int w, int h, char* label) {
}
void free_fl_check_button(CHECKBUTTON b) {
- delete static_cast<My_Check_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Check_Button*>(b);
+ }
}
diff --git a/body/c_fl_choice.cpp b/body/c_fl_choice.cpp
index 4b03532..e4471e5 100644
--- a/body/c_fl_choice.cpp
+++ b/body/c_fl_choice.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Choice.H>
#include "c_fl_choice.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ CHOICE new_fl_choice(int x, int y, int w, int h, char* label) {
}
void free_fl_choice(CHOICE b) {
- delete static_cast<My_Choice*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Choice*>(b);
+ }
}
diff --git a/body/c_fl_clock.cpp b/body/c_fl_clock.cpp
index e2df99c..2828f9e 100644
--- a/body/c_fl_clock.cpp
+++ b/body/c_fl_clock.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Clock.H>
#include "c_fl_clock.h"
+#include "c_fl.h"
@@ -55,7 +56,11 @@ CLOCK new_fl_clock2(unsigned char k, int x, int y, int w, int h, char* label) {
}
void free_fl_clock(CLOCK c) {
- delete static_cast<My_Clock*>(c);
+ if (fl_inside_callback) {
+ fl_delete_widget(c);
+ } else {
+ delete static_cast<My_Clock*>(c);
+ }
}
diff --git a/body/c_fl_clock_output.cpp b/body/c_fl_clock_output.cpp
index a34b1c4..7e977f3 100644
--- a/body/c_fl_clock_output.cpp
+++ b/body/c_fl_clock_output.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Clock.H>
#include "c_fl_clock_output.h"
+#include "c_fl.h"
@@ -61,7 +62,11 @@ CLOCKOUTPUT new_fl_clock_output(int x, int y, int w, int h, char* label) {
}
void free_fl_clock_output(CLOCKOUTPUT c) {
- delete static_cast<My_Clock_Output*>(c);
+ if (fl_inside_callback) {
+ fl_delete_widget(c);
+ } else {
+ delete static_cast<My_Clock_Output*>(c);
+ }
}
diff --git a/body/c_fl_color_chooser.cpp b/body/c_fl_color_chooser.cpp
index 31551b8..8f54437 100644
--- a/body/c_fl_color_chooser.cpp
+++ b/body/c_fl_color_chooser.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Color_Chooser.H>
#include "c_fl_color_chooser.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ COLORCHOOSER new_fl_color_chooser(int x, int y, int w, int h, char* label) {
}
void free_fl_color_chooser(COLORCHOOSER n) {
- delete static_cast<My_Color_Chooser*>(n);
+ if (fl_inside_callback) {
+ fl_delete_widget(n);
+ } else {
+ delete static_cast<My_Color_Chooser*>(n);
+ }
}
diff --git a/body/c_fl_counter.cpp b/body/c_fl_counter.cpp
index 9fe5d20..086a41d 100644
--- a/body/c_fl_counter.cpp
+++ b/body/c_fl_counter.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Counter.H>
#include "c_fl_counter.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ COUNTER new_fl_counter(int x, int y, int w, int h, char* label) {
}
void free_fl_counter(COUNTER c) {
- delete static_cast<My_Counter*>(c);
+ if (fl_inside_callback) {
+ fl_delete_widget(c);
+ } else {
+ delete static_cast<My_Counter*>(c);
+ }
}
diff --git a/body/c_fl_dial.cpp b/body/c_fl_dial.cpp
index af83c21..6bc5368 100644
--- a/body/c_fl_dial.cpp
+++ b/body/c_fl_dial.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Dial.H>
#include "c_fl_dial.h"
+#include "c_fl.h"
@@ -69,7 +70,11 @@ DIAL new_fl_dial(int x, int y, int w, int h, char* label) {
}
void free_fl_dial(DIAL v) {
- delete static_cast<My_Dial*>(v);
+ if (fl_inside_callback) {
+ fl_delete_widget(v);
+ } else {
+ delete static_cast<My_Dial*>(v);
+ }
}
diff --git a/body/c_fl_double_window.cpp b/body/c_fl_double_window.cpp
index 67db73b..bc9c48f 100644
--- a/body/c_fl_double_window.cpp
+++ b/body/c_fl_double_window.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Double_Window.H>
#include "c_fl_double_window.h"
+#include "c_fl.h"
@@ -66,7 +67,11 @@ DOUBLEWINDOW new_fl_double_window2(int w, int h, char* label) {
}
void free_fl_double_window(DOUBLEWINDOW d) {
- delete static_cast<My_Double_Window*>(d);
+ if (fl_inside_callback) {
+ fl_delete_widget(d);
+ } else {
+ delete static_cast<My_Double_Window*>(d);
+ }
}
diff --git a/body/c_fl_file_browser.cpp b/body/c_fl_file_browser.cpp
index 2e4f4c9..dfe45a8 100644
--- a/body/c_fl_file_browser.cpp
+++ b/body/c_fl_file_browser.cpp
@@ -8,6 +8,7 @@
#include <FL/Fl_Browser.H>
#include <FL/filename.H>
#include "c_fl_file_browser.h"
+#include "c_fl.h"
@@ -191,7 +192,11 @@ FILEBROWSER new_fl_file_browser(int x, int y, int w, int h, char * label) {
}
void free_fl_file_browser(FILEBROWSER b) {
- delete static_cast<My_File_Browser*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_File_Browser*>(b);
+ }
}
diff --git a/body/c_fl_file_input.cpp b/body/c_fl_file_input.cpp
index 8d0b15f..0fbea0a 100644
--- a/body/c_fl_file_input.cpp
+++ b/body/c_fl_file_input.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_File_Input.H>
#include "c_fl_file_input.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ FILEINPUT new_fl_file_input(int x, int y, int w, int h, char* label) {
}
void free_fl_file_input(FILEINPUT i) {
- delete static_cast<My_File_Input*>(i);
+ if (fl_inside_callback) {
+ fl_delete_widget(i);
+ } else {
+ delete static_cast<My_File_Input*>(i);
+ }
}
diff --git a/body/c_fl_fill_dial.cpp b/body/c_fl_fill_dial.cpp
index 47833c1..b29d581 100644
--- a/body/c_fl_fill_dial.cpp
+++ b/body/c_fl_fill_dial.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Fill_Dial.H>
#include "c_fl_fill_dial.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ FILLDIAL new_fl_fill_dial(int x, int y, int w, int h, char* label) {
}
void free_fl_fill_dial(FILLDIAL v) {
- delete static_cast<My_Fill_Dial*>(v);
+ if (fl_inside_callback) {
+ fl_delete_widget(v);
+ } else {
+ delete static_cast<My_Fill_Dial*>(v);
+ }
}
diff --git a/body/c_fl_fill_slider.cpp b/body/c_fl_fill_slider.cpp
index 49834d4..309960a 100644
--- a/body/c_fl_fill_slider.cpp
+++ b/body/c_fl_fill_slider.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Fill_Slider.H>
#include "c_fl_fill_slider.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ FILLSLIDER new_fl_fill_slider(int x, int y, int w, int h, char* label) {
}
void free_fl_fill_slider(FILLSLIDER s) {
- delete static_cast<My_Fill_Slider*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Fill_Slider*>(s);
+ }
}
diff --git a/body/c_fl_float_input.cpp b/body/c_fl_float_input.cpp
index eedfa36..ca8337a 100644
--- a/body/c_fl_float_input.cpp
+++ b/body/c_fl_float_input.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Float_Input.H>
#include "c_fl_float_input.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ FLOATINPUT new_fl_float_input(int x, int y, int w, int h, char* label) {
}
void free_fl_float_input(FLOATINPUT i) {
- delete static_cast<My_Float_Input*>(i);
+ if (fl_inside_callback) {
+ fl_delete_widget(i);
+ } else {
+ delete static_cast<My_Float_Input*>(i);
+ }
}
diff --git a/body/c_fl_gl_window.cpp b/body/c_fl_gl_window.cpp
index 3d6cbd5..adc33d3 100644
--- a/body/c_fl_gl_window.cpp
+++ b/body/c_fl_gl_window.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Gl_Window.H>
#include "c_fl_gl_window.h"
+#include "c_fl.h"
@@ -55,7 +56,11 @@ GLWINDOW new_fl_gl_window2(int w, int h, char* label) {
}
void free_fl_gl_window(GLWINDOW w) {
- delete static_cast<My_Gl_Window*>(w);
+ if (fl_inside_callback) {
+ fl_delete_widget(w);
+ } else {
+ delete static_cast<My_Gl_Window*>(w);
+ }
}
diff --git a/body/c_fl_group.cpp b/body/c_fl_group.cpp
index 62bee03..dde521c 100644
--- a/body/c_fl_group.cpp
+++ b/body/c_fl_group.cpp
@@ -8,6 +8,7 @@
#include <FL/Fl_Widget.H>
#include "c_fl_group.h"
#include "c_fl_widget.h"
+#include "c_fl.h"
@@ -65,7 +66,11 @@ GROUP new_fl_group(int x, int y, int w, int h, char* label) {
}
void free_fl_group(GROUP g) {
- delete static_cast<My_Group*>(g);
+ if (fl_inside_callback) {
+ fl_delete_widget(g);
+ } else {
+ delete static_cast<My_Group*>(g);
+ }
}
diff --git a/body/c_fl_help_view.cpp b/body/c_fl_help_view.cpp
index aa2fd65..db7807e 100644
--- a/body/c_fl_help_view.cpp
+++ b/body/c_fl_help_view.cpp
@@ -8,6 +8,7 @@
#include <FL/Fl_Help_View.H>
#include <FL/Enumerations.H>
#include "c_fl_help_view.h"
+#include "c_fl.h"
@@ -52,7 +53,11 @@ HELPVIEW new_fl_help_view(int x, int y, int w, int h, char * label) {
}
void free_fl_help_view(HELPVIEW v) {
- delete static_cast<My_Help_View*>(v);
+ if (fl_inside_callback) {
+ fl_delete_widget(v);
+ } else {
+ delete static_cast<My_Help_View*>(v);
+ }
}
diff --git a/body/c_fl_hold_browser.cpp b/body/c_fl_hold_browser.cpp
index 023e9ec..f5c2268 100644
--- a/body/c_fl_hold_browser.cpp
+++ b/body/c_fl_hold_browser.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Hold_Browser.H>
#include "c_fl_hold_browser.h"
+#include "c_fl.h"
@@ -172,7 +173,11 @@ HOLDBROWSER new_fl_hold_browser(int x, int y, int w, int h, char * label) {
}
void free_fl_hold_browser(HOLDBROWSER b) {
- delete static_cast<My_Hold_Browser*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Hold_Browser*>(b);
+ }
}
diff --git a/body/c_fl_hor_fill_slider.cpp b/body/c_fl_hor_fill_slider.cpp
index 9cd6ae2..1b35cf3 100644
--- a/body/c_fl_hor_fill_slider.cpp
+++ b/body/c_fl_hor_fill_slider.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Hor_Fill_Slider.H>
#include "c_fl_hor_fill_slider.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ HORFILLSLIDER new_fl_hor_fill_slider(int x, int y, int w, int h, char* label) {
}
void free_fl_hor_fill_slider(HORFILLSLIDER s) {
- delete static_cast<My_Hor_Fill_Slider*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Hor_Fill_Slider*>(s);
+ }
}
diff --git a/body/c_fl_hor_nice_slider.cpp b/body/c_fl_hor_nice_slider.cpp
index 29b271d..508d28b 100644
--- a/body/c_fl_hor_nice_slider.cpp
+++ b/body/c_fl_hor_nice_slider.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Hor_Nice_Slider.H>
#include "c_fl_hor_nice_slider.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ HORNICESLIDER new_fl_hor_nice_slider(int x, int y, int w, int h, char* label) {
}
void free_fl_hor_nice_slider(HORNICESLIDER s) {
- delete static_cast<My_Hor_Nice_Slider*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Hor_Nice_Slider*>(s);
+ }
}
diff --git a/body/c_fl_hor_value_slider.cpp b/body/c_fl_hor_value_slider.cpp
index cff16f6..341eb60 100644
--- a/body/c_fl_hor_value_slider.cpp
+++ b/body/c_fl_hor_value_slider.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Hor_Value_Slider.H>
#include "c_fl_hor_value_slider.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ HORVALUESLIDER new_fl_hor_value_slider(int x, int y, int w, int h, char* label)
}
void free_fl_hor_value_slider(HORVALUESLIDER s) {
- delete static_cast<My_Hor_Value_Slider*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Hor_Value_Slider*>(s);
+ }
}
diff --git a/body/c_fl_horizontal_slider.cpp b/body/c_fl_horizontal_slider.cpp
index 6a0ac22..6433a73 100644
--- a/body/c_fl_horizontal_slider.cpp
+++ b/body/c_fl_horizontal_slider.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Hor_Slider.H>
#include "c_fl_horizontal_slider.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ HORIZONTALSLIDER new_fl_horizontal_slider(int x, int y, int w, int h, char* labe
}
void free_fl_horizontal_slider(HORIZONTALSLIDER s) {
- delete static_cast<My_Horizontal_Slider*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Horizontal_Slider*>(s);
+ }
}
diff --git a/body/c_fl_input.cpp b/body/c_fl_input.cpp
index 6fa6b2d..799c76e 100644
--- a/body/c_fl_input.cpp
+++ b/body/c_fl_input.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Input.H>
#include "c_fl_input.h"
+#include "c_fl.h"
@@ -65,7 +66,11 @@ TEXTINPUT new_fl_text_input(int x, int y, int w, int h, char * label) {
}
void free_fl_text_input(TEXTINPUT t) {
- delete static_cast<My_Text_Input*>(t);
+ if (fl_inside_callback) {
+ fl_delete_widget(t);
+ } else {
+ delete static_cast<My_Text_Input*>(t);
+ }
}
diff --git a/body/c_fl_input_.cpp b/body/c_fl_input_.cpp
index 7fe0556..087a4a1 100644
--- a/body/c_fl_input_.cpp
+++ b/body/c_fl_input_.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Input_.H>
#include "c_fl_input_.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ INPUT new_fl_input(int x, int y, int w, int h, char* label) {
}
void free_fl_input(INPUT i) {
- delete static_cast<My_Input*>(i);
+ if (fl_inside_callback) {
+ fl_delete_widget(i);
+ } else {
+ delete static_cast<My_Input*>(i);
+ }
}
diff --git a/body/c_fl_input_choice.cpp b/body/c_fl_input_choice.cpp
index 247e8eb..dea3023 100644
--- a/body/c_fl_input_choice.cpp
+++ b/body/c_fl_input_choice.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Input_Choice.H>
#include "c_fl_input_choice.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ INPUTCHOICE new_fl_input_choice(int x, int y, int w, int h, char* label) {
}
void free_fl_input_choice(INPUTCHOICE n) {
- delete static_cast<My_Input_Choice*>(n);
+ if (fl_inside_callback) {
+ fl_delete_widget(n);
+ } else {
+ delete static_cast<My_Input_Choice*>(n);
+ }
}
diff --git a/body/c_fl_int_input.cpp b/body/c_fl_int_input.cpp
index 8f780d7..ff96560 100644
--- a/body/c_fl_int_input.cpp
+++ b/body/c_fl_int_input.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Int_Input.H>
#include "c_fl_int_input.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ INTINPUT new_fl_int_input(int x, int y, int w, int h, char* label) {
}
void free_fl_int_input(INTINPUT i) {
- delete static_cast<My_Int_Input*>(i);
+ if (fl_inside_callback) {
+ fl_delete_widget(i);
+ } else {
+ delete static_cast<My_Int_Input*>(i);
+ }
}
diff --git a/body/c_fl_light_button.cpp b/body/c_fl_light_button.cpp
index e11ce64..6c59730 100644
--- a/body/c_fl_light_button.cpp
+++ b/body/c_fl_light_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Light_Button.H>
#include "c_fl_light_button.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ LIGHTBUTTON new_fl_light_button(int x, int y, int w, int h, char* label) {
}
void free_fl_light_button(LIGHTBUTTON b) {
- delete static_cast<My_Light_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Light_Button*>(b);
+ }
}
diff --git a/body/c_fl_line_dial.cpp b/body/c_fl_line_dial.cpp
index 388264f..92059f2 100644
--- a/body/c_fl_line_dial.cpp
+++ b/body/c_fl_line_dial.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Line_Dial.H>
#include "c_fl_line_dial.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ LINEDIAL new_fl_line_dial(int x, int y, int w, int h, char* label) {
}
void free_fl_line_dial(LINEDIAL v) {
- delete static_cast<My_Line_Dial*>(v);
+ if (fl_inside_callback) {
+ fl_delete_widget(v);
+ } else {
+ delete static_cast<My_Line_Dial*>(v);
+ }
}
diff --git a/body/c_fl_menu.cpp b/body/c_fl_menu.cpp
index e42e985..2ef9402 100644
--- a/body/c_fl_menu.cpp
+++ b/body/c_fl_menu.cpp
@@ -7,6 +7,7 @@
#include <FL/Fl_Menu_.H>
#include <FL/Fl_Menu_Item.H>
#include "c_fl_menu.h"
+#include "c_fl.h"
@@ -53,7 +54,11 @@ MENU new_fl_menu(int x, int y, int w, int h, char* label) {
}
void free_fl_menu(MENU m) {
- delete static_cast<My_Menu*>(m);
+ if (fl_inside_callback) {
+ fl_delete_widget(m);
+ } else {
+ delete static_cast<My_Menu*>(m);
+ }
}
diff --git a/body/c_fl_menu_bar.cpp b/body/c_fl_menu_bar.cpp
index 5e73675..8419df6 100644
--- a/body/c_fl_menu_bar.cpp
+++ b/body/c_fl_menu_bar.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Menu_Bar.H>
#include "c_fl_menu_bar.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ MENUBAR new_fl_menu_bar(int x, int y, int w, int h, char* label) {
}
void free_fl_menu_bar(MENUBAR m) {
- delete static_cast<My_Menu_Bar*>(m);
+ if (fl_inside_callback) {
+ fl_delete_widget(m);
+ } else {
+ delete static_cast<My_Menu_Bar*>(m);
+ }
}
diff --git a/body/c_fl_menu_button.cpp b/body/c_fl_menu_button.cpp
index abe9712..8c04884 100644
--- a/body/c_fl_menu_button.cpp
+++ b/body/c_fl_menu_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Menu_Button.H>
#include "c_fl_menu_button.h"
+#include "c_fl.h"
@@ -66,7 +67,11 @@ MENUBUTTON new_fl_menu_button(int x, int y, int w, int h, char* label) {
}
void free_fl_menu_button(MENUBUTTON m) {
- delete static_cast<My_Menu_Button*>(m);
+ if (fl_inside_callback) {
+ fl_delete_widget(m);
+ } else {
+ delete static_cast<My_Menu_Button*>(m);
+ }
}
diff --git a/body/c_fl_menu_window.cpp b/body/c_fl_menu_window.cpp
index cae1bf9..30020c6 100644
--- a/body/c_fl_menu_window.cpp
+++ b/body/c_fl_menu_window.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Menu_Window.H>
#include "c_fl_menu_window.h"
+#include "c_fl.h"
@@ -55,7 +56,11 @@ MENUWINDOW new_fl_menu_window2(int w, int h, char* label) {
}
void free_fl_menu_window(MENUWINDOW m) {
- delete static_cast<My_Menu_Window*>(m);
+ if (fl_inside_callback) {
+ fl_delete_widget(m);
+ } else {
+ delete static_cast<My_Menu_Window*>(m);
+ }
}
diff --git a/body/c_fl_multi_browser.cpp b/body/c_fl_multi_browser.cpp
index 18bf5e8..ce0b077 100644
--- a/body/c_fl_multi_browser.cpp
+++ b/body/c_fl_multi_browser.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Multi_Browser.H>
#include "c_fl_multi_browser.h"
+#include "c_fl.h"
@@ -172,7 +173,11 @@ MULTIBROWSER new_fl_multi_browser(int x, int y, int w, int h, char * label) {
}
void free_fl_multi_browser(MULTIBROWSER b) {
- delete static_cast<My_Multi_Browser*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Multi_Browser*>(b);
+ }
}
diff --git a/body/c_fl_multiline_input.cpp b/body/c_fl_multiline_input.cpp
index ee99a13..2e193f2 100644
--- a/body/c_fl_multiline_input.cpp
+++ b/body/c_fl_multiline_input.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Multiline_Input.H>
#include "c_fl_multiline_input.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ MULTILINEINPUT new_fl_multiline_input(int x, int y, int w, int h, char* label) {
}
void free_fl_multiline_input(MULTILINEINPUT i) {
- delete static_cast<My_Multiline_Input*>(i);
+ if (fl_inside_callback) {
+ fl_delete_widget(i);
+ } else {
+ delete static_cast<My_Multiline_Input*>(i);
+ }
}
diff --git a/body/c_fl_multiline_output.cpp b/body/c_fl_multiline_output.cpp
index 2401fc7..e5c8f05 100644
--- a/body/c_fl_multiline_output.cpp
+++ b/body/c_fl_multiline_output.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Multiline_Output.H>
#include "c_fl_multiline_output.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ MULTILINEOUTPUT new_fl_multiline_output(int x, int y, int w, int h, char* label)
}
void free_fl_multiline_output(MULTILINEOUTPUT i) {
- delete static_cast<My_Multiline_Output*>(i);
+ if (fl_inside_callback) {
+ fl_delete_widget(i);
+ } else {
+ delete static_cast<My_Multiline_Output*>(i);
+ }
}
diff --git a/body/c_fl_nice_slider.cpp b/body/c_fl_nice_slider.cpp
index 082bbfc..5e34190 100644
--- a/body/c_fl_nice_slider.cpp
+++ b/body/c_fl_nice_slider.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Nice_Slider.H>
#include "c_fl_nice_slider.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ NICESLIDER new_fl_nice_slider(int x, int y, int w, int h, char* label) {
}
void free_fl_nice_slider(NICESLIDER s) {
- delete static_cast<My_Nice_Slider*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Nice_Slider*>(s);
+ }
}
diff --git a/body/c_fl_output.cpp b/body/c_fl_output.cpp
index 2e937dd..9fa36a1 100644
--- a/body/c_fl_output.cpp
+++ b/body/c_fl_output.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Output.H>
#include "c_fl_output.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ OUTPUTT new_fl_output(int x, int y, int w, int h, char* label) {
}
void free_fl_output(OUTPUTT i) {
- delete static_cast<My_Output*>(i);
+ if (fl_inside_callback) {
+ fl_delete_widget(i);
+ } else {
+ delete static_cast<My_Output*>(i);
+ }
}
diff --git a/body/c_fl_overlay_window.cpp b/body/c_fl_overlay_window.cpp
index 0d434c3..fa92eed 100644
--- a/body/c_fl_overlay_window.cpp
+++ b/body/c_fl_overlay_window.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Overlay_Window.H>
#include "c_fl_overlay_window.h"
+#include "c_fl.h"
@@ -65,7 +66,11 @@ OVERLAYWINDOW new_fl_overlay_window2(int w, int h, char *label) {
}
void free_fl_overlay_window(OVERLAYWINDOW w) {
- delete static_cast<My_Overlay_Window*>(w);
+ if (fl_inside_callback) {
+ fl_delete_widget(w);
+ } else {
+ delete static_cast<My_Overlay_Window*>(w);
+ }
}
diff --git a/body/c_fl_pack.cpp b/body/c_fl_pack.cpp
index e7cace9..48fa505 100644
--- a/body/c_fl_pack.cpp
+++ b/body/c_fl_pack.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Pack.H>
#include "c_fl_pack.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ PACK new_fl_pack(int x, int y, int w, int h, char* label) {
}
void free_fl_pack(PACK p) {
- delete static_cast<My_Pack*>(p);
+ if (fl_inside_callback) {
+ fl_delete_widget(p);
+ } else {
+ delete static_cast<My_Pack*>(p);
+ }
}
diff --git a/body/c_fl_positioner.cpp b/body/c_fl_positioner.cpp
index ce23b64..6a070d7 100644
--- a/body/c_fl_positioner.cpp
+++ b/body/c_fl_positioner.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Positioner.H>
#include "c_fl_positioner.h"
+#include "c_fl.h"
@@ -62,7 +63,11 @@ POSITIONER new_fl_positioner(int x, int y, int w, int h, char* label) {
}
void free_fl_positioner(POSITIONER p) {
- delete static_cast<My_Positioner*>(p);
+ if (fl_inside_callback) {
+ fl_delete_widget(p);
+ } else {
+ delete static_cast<My_Positioner*>(p);
+ }
}
diff --git a/body/c_fl_progress.cpp b/body/c_fl_progress.cpp
index 21a7a2d..7b13a48 100644
--- a/body/c_fl_progress.cpp
+++ b/body/c_fl_progress.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Progress.H>
#include "c_fl_progress.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ PROGRESS new_fl_progress(int x, int y, int w, int h, char* label) {
}
void free_fl_progress(PROGRESS p) {
- delete static_cast<My_Progress*>(p);
+ if (fl_inside_callback) {
+ fl_delete_widget(p);
+ } else {
+ delete static_cast<My_Progress*>(p);
+ }
}
diff --git a/body/c_fl_radio_button.cpp b/body/c_fl_radio_button.cpp
index 486c354..40c8fd5 100644
--- a/body/c_fl_radio_button.cpp
+++ b/body/c_fl_radio_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Radio_Button.H>
#include "c_fl_radio_button.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ RADIOBUTTON new_fl_radio_button(int x, int y, int w, int h, char* label) {
}
void free_fl_radio_button(RADIOBUTTON b) {
- delete static_cast<My_Radio_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Radio_Button*>(b);
+ }
}
diff --git a/body/c_fl_radio_light_button.cpp b/body/c_fl_radio_light_button.cpp
index f6da99e..ce57982 100644
--- a/body/c_fl_radio_light_button.cpp
+++ b/body/c_fl_radio_light_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Radio_Light_Button.H>
#include "c_fl_radio_light_button.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ RADIOLIGHTBUTTON new_fl_radio_light_button(int x, int y, int w, int h, char* lab
}
void free_fl_radio_light_button(RADIOLIGHTBUTTON b) {
- delete static_cast<My_Radio_Light_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Radio_Light_Button*>(b);
+ }
}
diff --git a/body/c_fl_radio_round_button.cpp b/body/c_fl_radio_round_button.cpp
index b09e1f3..62dc8e5 100644
--- a/body/c_fl_radio_round_button.cpp
+++ b/body/c_fl_radio_round_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Radio_Round_Button.H>
#include "c_fl_radio_round_button.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ RADIOROUNDBUTTON new_fl_radio_round_button(int x, int y, int w, int h, char* lab
}
void free_fl_radio_round_button(RADIOROUNDBUTTON b) {
- delete static_cast<My_Radio_Round_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Radio_Round_Button*>(b);
+ }
}
diff --git a/body/c_fl_repeat_button.cpp b/body/c_fl_repeat_button.cpp
index c3eb582..562a72d 100644
--- a/body/c_fl_repeat_button.cpp
+++ b/body/c_fl_repeat_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Repeat_Button.H>
#include "c_fl_repeat_button.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ REPEATBUTTON new_fl_repeat_button(int x, int y, int w, int h, char* label) {
}
void free_fl_repeat_button(REPEATBUTTON b) {
- delete static_cast<My_Repeat_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Repeat_Button*>(b);
+ }
}
diff --git a/body/c_fl_return_button.cpp b/body/c_fl_return_button.cpp
index 2c315d1..3211b7f 100644
--- a/body/c_fl_return_button.cpp
+++ b/body/c_fl_return_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Return_Button.H>
#include "c_fl_return_button.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ RETURNBUTTON new_fl_return_button(int x, int y, int w, int h, char* label) {
}
void free_fl_return_button(RETURNBUTTON b) {
- delete static_cast<My_Return_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Return_Button*>(b);
+ }
}
diff --git a/body/c_fl_roller.cpp b/body/c_fl_roller.cpp
index 1c65422..9f6753c 100644
--- a/body/c_fl_roller.cpp
+++ b/body/c_fl_roller.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Roller.H>
#include "c_fl_roller.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ ROLLER new_fl_roller(int x, int y, int w, int h, char* label) {
}
void free_fl_roller(ROLLER r) {
- delete static_cast<My_Roller*>(r);
+ if (fl_inside_callback) {
+ fl_delete_widget(r);
+ } else {
+ delete static_cast<My_Roller*>(r);
+ }
}
diff --git a/body/c_fl_round_button.cpp b/body/c_fl_round_button.cpp
index e6a9c43..3c9550e 100644
--- a/body/c_fl_round_button.cpp
+++ b/body/c_fl_round_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Round_Button.H>
#include "c_fl_round_button.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ ROUNDBUTTON new_fl_round_button(int x, int y, int w, int h, char* label) {
}
void free_fl_round_button(ROUNDBUTTON b) {
- delete static_cast<My_Round_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Round_Button*>(b);
+ }
}
diff --git a/body/c_fl_round_clock.cpp b/body/c_fl_round_clock.cpp
index 0036c00..85774c8 100644
--- a/body/c_fl_round_clock.cpp
+++ b/body/c_fl_round_clock.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Round_Clock.H>
#include "c_fl_round_clock.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ ROUNDCLOCK new_fl_round_clock(int x, int y, int w, int h, char* label) {
}
void free_fl_round_clock(ROUNDCLOCK c) {
- delete static_cast<My_Round_Clock*>(c);
+ if (fl_inside_callback) {
+ fl_delete_widget(c);
+ } else {
+ delete static_cast<My_Round_Clock*>(c);
+ }
}
diff --git a/body/c_fl_scroll.cpp b/body/c_fl_scroll.cpp
index a240139..3aa4364 100644
--- a/body/c_fl_scroll.cpp
+++ b/body/c_fl_scroll.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Scroll.H>
#include "c_fl_scroll.h"
+#include "c_fl.h"
@@ -75,7 +76,11 @@ SCROLL new_fl_scroll(int x, int y, int w, int h, char* label) {
}
void free_fl_scroll(SCROLL s) {
- delete static_cast<My_Scroll*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Scroll*>(s);
+ }
}
diff --git a/body/c_fl_scrollbar.cpp b/body/c_fl_scrollbar.cpp
index 2ebdb27..b71148a 100644
--- a/body/c_fl_scrollbar.cpp
+++ b/body/c_fl_scrollbar.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Scrollbar.H>
#include "c_fl_scrollbar.h"
+#include "c_fl.h"
@@ -72,7 +73,11 @@ SCROLLBAR new_fl_scrollbar(int x, int y, int w, int h, char* label) {
}
void free_fl_scrollbar(SCROLLBAR s) {
- delete static_cast<My_Scrollbar*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Scrollbar*>(s);
+ }
}
diff --git a/body/c_fl_secret_input.cpp b/body/c_fl_secret_input.cpp
index b3205cb..4ef4720 100644
--- a/body/c_fl_secret_input.cpp
+++ b/body/c_fl_secret_input.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Secret_Input.H>
#include "c_fl_secret_input.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ SECRETINPUT new_fl_secret_input(int x, int y, int w, int h, char* label) {
}
void free_fl_secret_input(SECRETINPUT i) {
- delete static_cast<My_Secret_Input*>(i);
+ if (fl_inside_callback) {
+ fl_delete_widget(i);
+ } else {
+ delete static_cast<My_Secret_Input*>(i);
+ }
}
diff --git a/body/c_fl_select_browser.cpp b/body/c_fl_select_browser.cpp
index 5993703..a0173fc 100644
--- a/body/c_fl_select_browser.cpp
+++ b/body/c_fl_select_browser.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Select_Browser.H>
#include "c_fl_select_browser.h"
+#include "c_fl.h"
@@ -172,7 +173,11 @@ SELECTBROWSER new_fl_select_browser(int x, int y, int w, int h, char * label) {
}
void free_fl_select_browser(SELECTBROWSER b) {
- delete static_cast<My_Select_Browser*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Select_Browser*>(b);
+ }
}
diff --git a/body/c_fl_simple_counter.cpp b/body/c_fl_simple_counter.cpp
index cf42d03..53aafab 100644
--- a/body/c_fl_simple_counter.cpp
+++ b/body/c_fl_simple_counter.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Simple_Counter.H>
#include "c_fl_simple_counter.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ SIMPLECOUNTER new_fl_simple_counter(int x, int y, int w, int h, char* label) {
}
void free_fl_simple_counter(SIMPLECOUNTER c) {
- delete static_cast<My_Simple_Counter*>(c);
+ if (fl_inside_callback) {
+ fl_delete_widget(c);
+ } else {
+ delete static_cast<My_Simple_Counter*>(c);
+ }
}
diff --git a/body/c_fl_single_window.cpp b/body/c_fl_single_window.cpp
index efafdc4..d22041e 100644
--- a/body/c_fl_single_window.cpp
+++ b/body/c_fl_single_window.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Single_Window.H>
#include "c_fl_single_window.h"
+#include "c_fl.h"
@@ -55,7 +56,11 @@ SINGLEWINDOW new_fl_single_window2(int x, int y, char* label) {
}
void free_fl_single_window(SINGLEWINDOW w) {
- delete static_cast<My_Single_Window*>(w);
+ if (fl_inside_callback) {
+ fl_delete_widget(w);
+ } else {
+ delete static_cast<My_Single_Window*>(w);
+ }
}
diff --git a/body/c_fl_slider.cpp b/body/c_fl_slider.cpp
index 449988c..bad03cd 100644
--- a/body/c_fl_slider.cpp
+++ b/body/c_fl_slider.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Slider.H>
#include "c_fl_slider.h"
+#include "c_fl.h"
@@ -74,7 +75,11 @@ SLIDER new_fl_slider2(unsigned char k, int x, int y, int w, int h, char * label)
}
void free_fl_slider(SLIDER s) {
- delete static_cast<My_Slider*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Slider*>(s);
+ }
}
diff --git a/body/c_fl_spinner.cpp b/body/c_fl_spinner.cpp
index 67a5312..d8683e5 100644
--- a/body/c_fl_spinner.cpp
+++ b/body/c_fl_spinner.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Spinner.H>
#include "c_fl_spinner.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ SPINNER new_fl_spinner(int x, int y, int w, int h, char* label) {
}
void free_fl_spinner(SPINNER n) {
- delete static_cast<My_Spinner*>(n);
+ if (fl_inside_callback) {
+ fl_delete_widget(n);
+ } else {
+ delete static_cast<My_Spinner*>(n);
+ }
}
diff --git a/body/c_fl_sys_menu_bar.cpp b/body/c_fl_sys_menu_bar.cpp
index fbd6e34..7f28574 100644
--- a/body/c_fl_sys_menu_bar.cpp
+++ b/body/c_fl_sys_menu_bar.cpp
@@ -7,6 +7,7 @@
#include <FL/Fl_Sys_Menu_Bar.H>
#include <FL/Fl_Menu_Item.H>
#include "c_fl_sys_menu_bar.h"
+#include "c_fl.h"
@@ -53,7 +54,11 @@ SYSMENUBAR new_fl_sys_menu_bar(int x, int y, int w, int h, char* label) {
}
void free_fl_sys_menu_bar(SYSMENUBAR m) {
- delete static_cast<My_Sys_Menu_Bar*>(m);
+ if (fl_inside_callback) {
+ fl_delete_widget(m);
+ } else {
+ delete static_cast<My_Sys_Menu_Bar*>(m);
+ }
}
diff --git a/body/c_fl_table.cpp b/body/c_fl_table.cpp
index b264c1e..377ec37 100644
--- a/body/c_fl_table.cpp
+++ b/body/c_fl_table.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Table.H>
#include "c_fl_table.h"
+#include "c_fl.h"
@@ -105,7 +106,11 @@ TABLE new_fl_table(int x, int y, int w, int h, char * label) {
}
void free_fl_table(TABLE t) {
- delete static_cast<My_Table*>(t);
+ if (fl_inside_callback) {
+ fl_delete_widget(t);
+ } else {
+ delete static_cast<My_Table*>(t);
+ }
}
diff --git a/body/c_fl_table_row.cpp b/body/c_fl_table_row.cpp
index 8094df4..0ded792 100644
--- a/body/c_fl_table_row.cpp
+++ b/body/c_fl_table_row.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Table_Row.H>
#include "c_fl_table_row.h"
+#include "c_fl.h"
@@ -68,7 +69,11 @@ ROWTABLE new_fl_table_row(int x, int y, int w, int h, char * label) {
}
void free_fl_table_row(ROWTABLE t) {
- delete static_cast<My_Table_Row*>(t);
+ if (fl_inside_callback) {
+ fl_delete_widget(t);
+ } else {
+ delete static_cast<My_Table_Row*>(t);
+ }
}
diff --git a/body/c_fl_tabs.cpp b/body/c_fl_tabs.cpp
index df7327f..4e09135 100644
--- a/body/c_fl_tabs.cpp
+++ b/body/c_fl_tabs.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Tabs.H>
#include "c_fl_tabs.h"
+#include "c_fl.h"
@@ -60,7 +61,11 @@ TABS new_fl_tabs(int x, int y, int w, int h, char* label) {
}
void free_fl_tabs(TABS t) {
- delete static_cast<My_Tabs*>(t);
+ if (fl_inside_callback) {
+ fl_delete_widget(t);
+ } else {
+ delete static_cast<My_Tabs*>(t);
+ }
}
diff --git a/body/c_fl_text_display.cpp b/body/c_fl_text_display.cpp
index a50f25d..bf9dacf 100644
--- a/body/c_fl_text_display.cpp
+++ b/body/c_fl_text_display.cpp
@@ -8,6 +8,7 @@
#include <FL/Fl_Text_Buffer.H>
#include "c_fl_text_display.h"
#include "c_fl_text_buffer.h"
+#include "c_fl.h"
@@ -104,7 +105,11 @@ TEXTDISPLAY new_fl_text_display(int x, int y, int w, int h, char* label) {
}
void free_fl_text_display(TEXTDISPLAY td) {
- delete static_cast<My_Text_Display*>(td);
+ if (fl_inside_callback) {
+ fl_delete_widget(td);
+ } else {
+ delete static_cast<My_Text_Display*>(td);
+ }
}
diff --git a/body/c_fl_text_editor.cpp b/body/c_fl_text_editor.cpp
index 0da5f5e..0efea0b 100644
--- a/body/c_fl_text_editor.cpp
+++ b/body/c_fl_text_editor.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Text_Editor.H>
#include "c_fl_text_editor.h"
+#include "c_fl.h"
@@ -61,7 +62,11 @@ TEXTEDITOR new_fl_text_editor(int x, int y, int w, int h, char* label) {
}
void free_fl_text_editor(TEXTEDITOR te) {
- delete static_cast<My_Text_Editor*>(te);
+ if (fl_inside_callback) {
+ fl_delete_widget(te);
+ } else {
+ delete static_cast<My_Text_Editor*>(te);
+ }
}
diff --git a/body/c_fl_tile.cpp b/body/c_fl_tile.cpp
index 81f820a..feea448 100644
--- a/body/c_fl_tile.cpp
+++ b/body/c_fl_tile.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Tile.H>
#include "c_fl_tile.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ TILE new_fl_tile(int x, int y, int w, int h, char* label) {
}
void free_fl_tile(TILE t) {
- delete static_cast<My_Tile*>(t);
+ if (fl_inside_callback) {
+ fl_delete_widget(t);
+ } else {
+ delete static_cast<My_Tile*>(t);
+ }
}
diff --git a/body/c_fl_toggle_button.cpp b/body/c_fl_toggle_button.cpp
index d396f37..f87e78a 100644
--- a/body/c_fl_toggle_button.cpp
+++ b/body/c_fl_toggle_button.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Toggle_Button.H>
#include "c_fl_toggle_button.h"
+#include "c_fl.h"
@@ -50,7 +51,11 @@ TOGGLEBUTTON new_fl_toggle_button(int x, int y, int w, int h, char* label) {
}
void free_fl_toggle_button(TOGGLEBUTTON b) {
- delete static_cast<My_Toggle_Button*>(b);
+ if (fl_inside_callback) {
+ fl_delete_widget(b);
+ } else {
+ delete static_cast<My_Toggle_Button*>(b);
+ }
}
diff --git a/body/c_fl_valuator.cpp b/body/c_fl_valuator.cpp
index 3b4ebba..44ab601 100644
--- a/body/c_fl_valuator.cpp
+++ b/body/c_fl_valuator.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Valuator.H>
#include "c_fl_valuator.h"
+#include "c_fl.h"
@@ -68,7 +69,11 @@ VALUATOR new_fl_valuator(int x, int y, int w, int h, char* label) {
}
void free_fl_valuator(VALUATOR v) {
- delete static_cast<My_Valuator*>(v);
+ if (fl_inside_callback) {
+ fl_delete_widget(v);
+ } else {
+ delete static_cast<My_Valuator*>(v);
+ }
}
diff --git a/body/c_fl_value_input.cpp b/body/c_fl_value_input.cpp
index 3d19845..29a7772 100644
--- a/body/c_fl_value_input.cpp
+++ b/body/c_fl_value_input.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Value_Input.H>
#include "c_fl_value_input.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ VALUEINPUT new_fl_value_input(int x, int y, int w, int h, char* label) {
}
void free_fl_value_input(VALUEINPUT a) {
- delete static_cast<My_Value_Input*>(a);
+ if (fl_inside_callback) {
+ fl_delete_widget(a);
+ } else {
+ delete static_cast<My_Value_Input*>(a);
+ }
}
diff --git a/body/c_fl_value_output.cpp b/body/c_fl_value_output.cpp
index 5e42996..2929cc7 100644
--- a/body/c_fl_value_output.cpp
+++ b/body/c_fl_value_output.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Value_Output.H>
#include "c_fl_value_output.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ VALUEOUTPUT new_fl_value_output(int x, int y, int w, int h, char* label) {
}
void free_fl_value_output(VALUEOUTPUT a) {
- delete static_cast<My_Value_Output*>(a);
+ if (fl_inside_callback) {
+ fl_delete_widget(a);
+ } else {
+ delete static_cast<My_Value_Output*>(a);
+ }
}
diff --git a/body/c_fl_value_slider.cpp b/body/c_fl_value_slider.cpp
index ac7498c..4d881c9 100644
--- a/body/c_fl_value_slider.cpp
+++ b/body/c_fl_value_slider.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Value_Slider.H>
#include "c_fl_value_slider.h"
+#include "c_fl.h"
@@ -57,7 +58,11 @@ VALUESLIDER new_fl_value_slider(int x, int y, int w, int h, char* label) {
}
void free_fl_value_slider(VALUESLIDER s) {
- delete static_cast<My_Value_Slider*>(s);
+ if (fl_inside_callback) {
+ fl_delete_widget(s);
+ } else {
+ delete static_cast<My_Value_Slider*>(s);
+ }
}
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);
+ }
}
diff --git a/body/c_fl_window.cpp b/body/c_fl_window.cpp
index e41af01..d0314be 100644
--- a/body/c_fl_window.cpp
+++ b/body/c_fl_window.cpp
@@ -7,6 +7,7 @@
#include <FL/Fl_Window.H>
#include <FL/Fl_RGB_Image.H>
#include "c_fl_window.h"
+#include "c_fl.h"
@@ -67,7 +68,11 @@ WINDOW new_fl_window2(int w, int h, char* label) {
}
void free_fl_window(WINDOW n) {
- delete static_cast<My_Window*>(n);
+ if (fl_inside_callback) {
+ fl_delete_widget(n);
+ } else {
+ delete static_cast<My_Window*>(n);
+ }
}
diff --git a/body/c_fl_wizard.cpp b/body/c_fl_wizard.cpp
index e29995a..b494cc3 100644
--- a/body/c_fl_wizard.cpp
+++ b/body/c_fl_wizard.cpp
@@ -6,6 +6,7 @@
#include <FL/Fl_Wizard.H>
#include "c_fl_wizard.h"
+#include "c_fl.h"
@@ -67,7 +68,11 @@ WIZARD new_fl_wizard(int x, int y, int w, int h, char* label) {
}
void free_fl_wizard(WIZARD w) {
- delete static_cast<My_Wizard*>(w);
+ if (fl_inside_callback) {
+ fl_delete_widget(w);
+ } else {
+ delete static_cast<My_Wizard*>(w);
+ }
}
diff --git a/body/fltk.adb b/body/fltk.adb
index 4dfdf8f..aaef1fd 100644
--- a/body/fltk.adb
+++ b/body/fltk.adb
@@ -98,7 +98,7 @@ package body FLTK is
function fl_wait2
(S : in Interfaces.C.double)
- return Interfaces.C.int;
+ return Interfaces.C.double;
pragma Import (C, fl_wait2, "fl_wait2");
pragma Inline (fl_wait2);
@@ -449,9 +449,9 @@ package body FLTK is
function Wait
(Seconds : in Long_Float)
- return Integer is
+ return Long_Float is
begin
- return Integer (fl_wait2 (Interfaces.C.double (Seconds)));
+ return Long_Float (fl_wait2 (Interfaces.C.double (Seconds)));
end Wait;
diff --git a/doc/fl.html b/doc/fl.html
index db60f5b..d79ed1a 100644
--- a/doc/fl.html
+++ b/doc/fl.html
@@ -1997,7 +1997,7 @@ static double wait(double time);
<td><pre>
function Wait
(Seconds : in Long_Float)
- return Integer;
+ return Long_Float;
</pre></td>
</tr>
diff --git a/spec/fltk.ads b/spec/fltk.ads
index 8129281..f5287de 100644
--- a/spec/fltk.ads
+++ b/spec/fltk.ads
@@ -443,7 +443,7 @@ package FLTK is
function Wait
(Seconds : in Long_Float)
- return Integer;
+ return Long_Float;
function Run
return Integer;