diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-10-09 19:53:05 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-10-09 19:53:05 +0000 |
| commit | b10524fce26205c78b72a4f4e613204abf696378 (patch) | |
| tree | 78cad61869dc8e1fd48ad66bcb65fc7f9a588142 | |
| parent | 17e593b2549999463081552923d859ce46938b0a (diff) | |
Avoiding crash when accessing free'd memory.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13064 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | fluid/fluid.cxx | 7 | ||||
| -rw-r--r-- | fluid/function_panel.fl | 15 | ||||
| -rw-r--r-- | src/Fl_Menu_add.cxx | 2 |
3 files changed, 13 insertions, 11 deletions
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index e13a171b3..5b1cb0c35 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -566,7 +566,10 @@ void open_history_cb(Fl_Widget *, void *v) { set_modflag(0); undo_resume(); undo_clear(); - if (oldfilename) free((void *)oldfilename); + if (oldfilename) { + free((void *)oldfilename); + oldfilename = 0L; + } } void new_cb(Fl_Widget *, void *v) { @@ -1760,7 +1763,7 @@ int main(int argc,char **argv) { " -cs : write .cxx and .h and strings and exit\n" " -o <name> : .cxx output filename, or extension if <name> starts with '.'\n" " -h <name> : .h output filename, or extension if <name> starts with '.'\n"; - int len = (int)(strlen(msg) + strlen(argv[0]) + strlen(Fl::help)); + int len = (int)(strlen(msg) + strlen(argv[0]?argv[0]:"fluid") + strlen(Fl::help)); Fl_Plugin_Manager pm("commandline"); int i, n = pm.plugins(); for (i=0; i<n; i++) { diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl index f8c6de902..fed57dcd1 100644 --- a/fluid/function_panel.fl +++ b/fluid/function_panel.fl @@ -55,7 +55,7 @@ Function {use_tab_navigation(int, Fl_Text_Editor*)} { Function {make_function_panel()} {} { Fl_Window function_panel { label {Function/Method Properties} open - xywh {557 523 343 232} type Double hide resizable modal + xywh {557 523 343 232} type Double resizable modal visible } { Fl_Group {} {open xywh {10 10 270 20} @@ -257,7 +257,8 @@ Function {make_declblock_panel()} {} { } } -Function {make_decl_panel()} {} { +Function {make_decl_panel()} {selected +} { Fl_Window decl_panel { label {Declaration Properties} open xywh {480 333 343 237} type Double align 80 hide resizable size_range {343 237 0 0} @@ -333,11 +334,10 @@ Function {make_decl_panel()} {} { } } -Function {make_data_panel()} {open -} { +Function {make_data_panel()} {} { Fl_Window data_panel { label {Inline Data Properties} open - xywh {472 191 343 237} type Double align 80 hide resizable size_range {343 237 0 0} + xywh {472 191 343 237} type Double align 80 resizable size_range {343 237 0 0} visible } { Fl_Group {} {open xywh {10 10 320 20} @@ -399,7 +399,7 @@ Function {make_data_panel()} {open xywh {290 90 40 20} labelcolor 134 } Fl_Text_Editor data_comment_input { - label {Comment:} selected + label {Comment:} tooltip {Declaration comment in Doxygen format} xywh {10 130 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable code0 {data_comment_input->buffer(new Fl_Text_Buffer());} code1 {data_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);} @@ -536,8 +536,7 @@ Function {type_make_cb(Fl_Widget*,void*d)} {return_type void }} {} } -Function {make_widgetbin()} {open -} { +Function {make_widgetbin()} {} { Fl_Window widgetbin_panel { label {Widget Bin} callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) diff --git a/src/Fl_Menu_add.cxx b/src/Fl_Menu_add.cxx index 2406a383f..32da93df3 100644 --- a/src/Fl_Menu_add.cxx +++ b/src/Fl_Menu_add.cxx @@ -464,7 +464,7 @@ void Fl_Menu_::replace(int i, const char *str) { if (!alloc) copy(menu_); if (alloc > 1) { free((void *)menu_[i].text); - str = strdup(str); + str = strdup(str?str:""); } menu_[i].text = str; } |
