changeset 1851:400a06a83891

quick fix for Layout::getWidgetAtPoint() crash in fltk-1.3 fltk-1.3 calls fl_fix_focus() on widget deletion, which causes dillo to traverse it's own widget tree while it's getting deleted. Stop this using a flag for now. It would be nice if we could fix this more elegantly.
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 21 Jan 2011 23:48:30 +0100
parents dd9528825b2f
children 7f050e0ef6d6
files dw/layout.cc dw/layout.hh
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dw/layout.cc	Thu Jan 20 22:04:02 2011 +0100
+++ b/dw/layout.cc	Fri Jan 21 23:48:30 2011 +0100
@@ -185,6 +185,7 @@
    view = NULL;
    topLevel = NULL;
    widgetAtPoint = NULL;
+   deletingTopLevel = false;
 
    DBG_OBJ_CREATE (this, "DwRenderLayout");
 
@@ -278,9 +279,11 @@
 
 void Layout::setWidget (Widget *widget)
 {
+   widgetAtPoint = NULL;
+   deletingTopLevel = true;
    if (topLevel)
       delete topLevel;
-   widgetAtPoint = NULL;
+   deletingTopLevel = false;
    textZone->zoneFree ();
    addWidget (widget);
 
@@ -828,7 +831,7 @@
 {
    _MSG ("------------------------------------------------------------\n");
    _MSG ("widget at (%d, %d)\n", x, y);
-   if (topLevel)
+   if (topLevel && !deletingTopLevel)
       return topLevel->getWidgetAtPoint (x, y, 0);
    else
       return NULL;
--- a/dw/layout.hh	Thu Jan 20 22:04:02 2011 +0100
+++ b/dw/layout.hh	Fri Jan 21 23:48:30 2011 +0100
@@ -132,6 +132,7 @@
    Platform *platform;
    View *view;
    Widget *topLevel, *widgetAtPoint;
+   bool deletingTopLevel; // XXX quick hack for fltk-1.3 port
 
    /* The state, which must be projected into the view. */
    style::Color *bgColor;