STR #1010: if a widget callback is generated inside a widget class, the static callback uses the parent() function to find the 'this' pointer, instead of the 'user_data()' member, which would be NULL anyways
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4556 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
f0d44ed955
commit
edcc1980a1
@ -1838,10 +1838,13 @@ void Fl_Widget_Type::write_static() {
|
||||
write_c("\n}\n");
|
||||
if (k) {
|
||||
write_c("void %s::%s(%s* o, %s v) {\n", k, cn, t, ut);
|
||||
write_c(" ((%s*)(o->", k);
|
||||
for (Fl_Type* p = parent; p && p->is_widget(); p = p->parent)
|
||||
write_c("parent()->");
|
||||
write_c("user_data()))->%s_i(o,v);\n}\n", cn);
|
||||
write_c(" ((%s*)(o", k);
|
||||
Fl_Type *q = 0;
|
||||
for (Fl_Type* p = parent; p && p->is_widget(); q = p, p = p->parent)
|
||||
write_c("->parent()");
|
||||
if (!q || strcmp(q->type_name(), "widget_class"))
|
||||
write_c("->user_data()");
|
||||
write_c("))->%s_i(o,v);\n}\n", cn);
|
||||
}
|
||||
}
|
||||
if (image) {
|
||||
@ -1881,7 +1884,7 @@ void Fl_Widget_Type::write_code1() {
|
||||
write_h(" void %s_i(%s*, %s);\n", cn, t, ut);
|
||||
write_h(" static void %s(%s*, %s);\n", cn, t, ut);
|
||||
}
|
||||
// figure out if local varaible will be used (prevent compiler warnings):
|
||||
// figure out if local variable will be used (prevent compiler warnings):
|
||||
if (is_parent())
|
||||
varused = 1;
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user