diff options
| author | Matthias Melcher <git@matthiasm.com> | 2019-02-01 21:32:48 +0100 |
|---|---|---|
| committer | Matthias Melcher <git@matthiasm.com> | 2019-02-01 21:32:48 +0100 |
| commit | 2b6347d0bd279ab2e45dfedc9390fd8c886b6a00 (patch) | |
| tree | ea645a01a247e6bc04efece145b38de9a31b4277 /fluid | |
| parent | aa6d9b74c69c39874daf159187bfbd829c3a20f8 (diff) | |
STR #3445: Duplicating Widget Class in Fluid no longer crashes.
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 2 | ||||
| -rw-r--r-- | fluid/factory.cxx | 10 | ||||
| -rw-r--r-- | fluid/file.cxx | 58 |
3 files changed, 40 insertions, 30 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 7023fbf2d..2123074c4 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -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; diff --git a/fluid/factory.cxx b/fluid/factory.cxx index 4008536df..c71fc97ae 100644 --- a/fluid/factory.cxx +++ b/fluid/factory.cxx @@ -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; diff --git a/fluid/file.cxx b/fluid/file.cxx index 10259f267..65c4131bb 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -450,40 +450,44 @@ static void read_children(Fl_Type *p, int paste) { goto CONTINUE; } - {Fl_Type *t = Fl_Type_make(c); - if (!t) { - read_error("Unknown word \"%s\"", c); - continue; - } - t->name(read_word()); + { + Fl_Type *t = Fl_Type_make(c); + if (!t) { + read_error("Unknown word \"%s\"", c); + continue; + } + t->name(read_word()); - c = read_word(1); - if (strcmp(c,"{") && t->is_class()) { // <prefix> <name> - ((Fl_Class_Type*)t)->prefix(t->name()); - t->name(c); c = read_word(1); - } + if (strcmp(c,"{") && t->is_class()) { // <prefix> <name> + ((Fl_Class_Type*)t)->prefix(t->name()); + t->name(c); + c = read_word(1); + } - if (strcmp(c,"{")) { - read_error("Missing property list for %s\n",t->title()); - goto REUSE_C; - } + if (strcmp(c,"{")) { + read_error("Missing property list for %s\n",t->title()); + goto REUSE_C; + } - t->open_ = 0; - for (;;) { - const char *cc = read_word(); - if (!cc || !strcmp(cc,"}")) break; - t->read_property(cc); - } + t->open_ = 0; + for (;;) { + const char *cc = read_word(); + if (!cc || !strcmp(cc,"}")) break; + t->read_property(cc); + } - if (!t->is_parent()) continue; - c = read_word(1); - if (strcmp(c,"{")) { - read_error("Missing child list for %s\n",t->title()); - goto REUSE_C; + if (!t->is_parent()) continue; + c = read_word(1); + if (strcmp(c,"{")) { + 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:; } } |
