Andreas Ekstrand wrote:
Thanks, Albrecht. I think I'll wait for your solutions for both preventing
crashes and avoiding the fix_focus problems, before deciding if I should delete
my Fl_Scroll or append the Fl_button patch.
I have all respect for that you have other things to attend to, but I'm looking
forward to your next update.
Andreas, I have made some progress, and I think that I can do
something more at the weekend. But I need your assistance...
Please use the current svn version and apply the two attached
patches.
Then please test the performance again. This will probably not
change much (or anything at all). Please report your results.
Then, please answer these questions:
- what when() conditions do your buttons have?
Default would be FL_WHEN_RELEASE.
- if it's not FL_WHEN_RELEASE, do you use a handle() method,
and if, when does it call the callback: on FL_PUSH or on
FL_RELEASE?
- please describe, if you're doing anything else
If your buttons (inside the Fl_Scroll that you use to call
Fl_Group::clear()) have FL_WHEN_RELEASE set, please change
it to FL_WHEN_CHANGED, or change anything else so that the
callback is called when the mouse button is [FL_]PUSH'ed.
Please report, what happens. In my tests, this gives a giant
performance boost, but I do not yet know why this is so much
different. exactly. I'm still investigating the fl_fix_focus
problem, and your feedback would perhaps help me to find the
underlying problem. Thanks for your patience ...
BTW.: The Fl_Group patch fixes a problem that I didn't see
yet, and that I found when I investigated your problem. This
could result in a program crash (and it did in my tests).
I will probably update the subversion repository over the
weekend, so that these patches will be included in one of my
next commits. At the time of this writing we have subversion
release 7100.
Albrecht
Index: src/Fl_Group.cxx
===================================================================
--- src/Fl_Group.cxx (revision 7091)
+++ src/Fl_Group.cxx (working copy)
@@ -227,8 +227,9 @@
for (i = children(); i--;) {
o = a[i];
if (o->takesevents() && Fl::event_inside(o)) {
+ Fl_Widget_Tracker wp(o);
if (send(o,FL_PUSH)) {
- if (Fl::pushed() && !o->contains(Fl::pushed())) Fl::pushed(o);
+ if (Fl::pushed() && wp.exists() && !o->contains(Fl::pushed()))
Fl::pushed(o);
return 1;
}
}
Index: src/Fl_Button.cxx
===================================================================
--- src/Fl_Button.cxx (revision 7091)
+++ src/Fl_Button.cxx (working copy)
@@ -117,7 +117,11 @@
else {
value(oldval);
set_changed();
- if (when() & FL_WHEN_CHANGED) do_callback();
+ if (when() & FL_WHEN_CHANGED) {
+ Fl_Widget_Tracker wp(this);
+ do_callback();
+ if (wp.deleted()) return 1;
+ }
}
if (when() & FL_WHEN_RELEASE) do_callback();
return 1;
@@ -156,6 +160,7 @@
if (Fl::focus() == this && Fl::event_key() == ' ' &&
!(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) {
set_changed();
+ Fl_Widget_Tracker wp(this);
if (type() == FL_RADIO_BUTTON && !value_) {
setonly();
if (when() & FL_WHEN_CHANGED) do_callback();
@@ -163,6 +168,7 @@
value(!value());
if (when() & FL_WHEN_CHANGED) do_callback();
}
+ if (wp.deleted()) return 1;
if (when() & FL_WHEN_RELEASE) do_callback();
return 1;
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev