Skip to content

Commit

Permalink
Avoiding crash when accessing free'd memory.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13064 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Matthias Melcher committed Oct 9, 2018
1 parent 17e593b commit b10524f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
7 changes: 5 additions & 2 deletions fluid/fluid.cxx
Expand Up @@ -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) {
Expand Down Expand Up @@ -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++) {
Expand Down
15 changes: 7 additions & 8 deletions fluid/function_panel.fl
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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);}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_Menu_add.cxx
Expand Up @@ -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;
}
Expand Down

0 comments on commit b10524f

Please sign in to comment.