STR #3445: Duplicating Widget Class in Fluid no longer crashes.

This commit is contained in:
Matthias Melcher 2019-02-01 21:32:48 +01:00
parent aa6d9b74c6
commit 2b6347d0bd
4 changed files with 43 additions and 32 deletions

View File

@ -145,6 +145,7 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2019
Bug Fixes
- (add new items here)
- Duplicating Widget Class in Fluid no longer crashes (STR #3445).
- Fl_Check_Browser::add(item) now accepts NULL (STR #3498).
- Interface to set maximum width of spinner text field (STR #3386).
- Fl_Text_Display no longer wiggles (STR #2531).

View File

@ -102,7 +102,7 @@ Fl_Type *Fl_Widget_Type::make() {
Fl_Widget_Type* q = (Fl_Widget_Type*)qq;
// find the parent widget:
Fl_Widget_Type* p = q;
if ((force_parent || !p->is_group()) && p->parent->is_widget())
if ((force_parent || !p->is_group()) && p->parent && p->parent->is_widget())
p = (Fl_Widget_Type*)(p->parent);
force_parent = 0;

View File

@ -1116,8 +1116,14 @@ Fl_Type *Fl_Type_make(const char *tn) {
Fl_Menu_Item *m = New_Menu+i;
if (!m->user_data()) continue;
Fl_Type *t = (Fl_Type*)(m->user_data());
if (!fl_ascii_strcasecmp(tn,t->type_name())) {r = t->make(); break;}
if (!fl_ascii_strcasecmp(tn,t->alt_type_name())) {r = t->make(); break;}
if (!fl_ascii_strcasecmp(tn,t->type_name())) {
r = t->make();
break;
}
if (!fl_ascii_strcasecmp(tn,t->alt_type_name())) {
r = t->make();
break;
}
}
reading_file = 0;
return r;

View File

@ -450,7 +450,8 @@ static void read_children(Fl_Type *p, int paste) {
goto CONTINUE;
}
{Fl_Type *t = Fl_Type_make(c);
{
Fl_Type *t = Fl_Type_make(c);
if (!t) {
read_error("Unknown word \"%s\"", c);
continue;
@ -482,8 +483,11 @@ static void read_children(Fl_Type *p, int paste) {
read_error("Missing child list for %s\n",t->title());
goto REUSE_C;
}
read_children(t, 0);}
read_children(t, 0);
}
Fl_Type::current = p;
CONTINUE:;
}
}