Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_embed.c ewl_widget.c 


Log Message:
- reorder the destroy code a bit to make things happen right away
- fix the embed->last.clicked as it could be getting set to a widget that is
  already destroyed

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- ewl_embed.c 24 May 2006 03:59:52 -0000      1.60
+++ ewl_embed.c 25 May 2006 05:57:12 -0000      1.61
@@ -466,6 +466,14 @@
                temp = temp->parent;
 
        ewl_embed_focused_widget_set(embed, temp);
+
+       /*
+        * Make sure we set this _BEFORE_ doing the callbacks below because
+        * the CLICK or DOWN callback may trigger the widget itself to be
+        * deleted which will trigger a cleanup of the info widgets. if we
+        * cleanup this widget we don't want to be setting it as
+        * last.clicked after that.
+        */
        embed->last.clicked = widget;
 
        ev.modifiers = mods;
@@ -518,8 +526,6 @@
                        ewl_callback_call(widget, EWL_CALLBACK_FOCUS_IN);
                }
        }
-
-       embed->last.clicked = widget;
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- ewl_widget.c        24 May 2006 03:59:10 -0000      1.78
+++ ewl_widget.c        25 May 2006 05:57:12 -0000      1.79
@@ -398,6 +398,9 @@
 void
 ewl_widget_destroy(Ewl_Widget * w)
 {
+       int i;
+       Ewl_Embed *emb;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
@@ -407,17 +410,42 @@
                                        EWL_FLAG_QUEUED_DPROCESS)))
                DRETURN(DLEVEL_STABLE);
 
+
+       /* cleanup any dnd widgets */
        if (w == ewl_widget_drag_candidate_get())
                ewl_widget_dnd_reset();
 
+       emb = ewl_embed_widget_find(w);
+       if (emb) ewl_embed_info_widgets_cleanup(emb, w);
+
        /*
         * Request prior to hiding so we can skip resizing for child widgets
         * being hidden.
         */
        ewl_destroy_request(w);
 
-       if (w->parent)
-               ewl_container_child_remove(EWL_CONTAINER(w->parent), w);
+       ewl_widget_hide(w);
+       ewl_widget_unrealize(w);
+
+       /* 
+        * remove ourselves from any containers 
+        */ 
+       ewl_widget_parent_set(w, NULL);
+
+       /*
+        * Clear out the callbacks, this is a bit tricky because we don't want
+        * to continue using this widget after the callbacks have been
+        * deleted. Clear all callbacks except for the destroy callbacks.
+        * This preserves the list of the destroy type so we don't get a 
segfault.
+        *
+        * We delete these now so that we can't possibly get any callbacks 
before the 
+        * idler kicks in
+        */
+       for (i = 0; i < EWL_CALLBACK_MAX; i++)
+       {
+               if (i == EWL_CALLBACK_DESTROY) continue;
+               ewl_callback_del_type(w, i);
+       }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -715,7 +743,7 @@
  * callback is triggered to notify children of w of the change in parent.
  */
 void
-ewl_widget_parent_set(Ewl_Widget * w, Ewl_Widget * p)
+ewl_widget_parent_set(Ewl_Widget *w, Ewl_Widget *p)
 {
        Ewl_Widget *tmp;
        Ewl_Container *op;
@@ -728,7 +756,6 @@
        op = EWL_CONTAINER(w->parent);
        if (op == EWL_CONTAINER(p))
                DRETURN(DLEVEL_STABLE);
-       
 
        if (!p)
                ewl_widget_obscure(w);
@@ -2000,25 +2027,10 @@
 ewl_widget_destroy_cb(Ewl_Widget * w, void *ev_data __UNUSED__,
                        void *data __UNUSED__)
 {
-       int i;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
-       ewl_callback_del(w, EWL_CALLBACK_MOUSE_DOWN, ewl_widget_drag_down_cb);
-       ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE, ewl_widget_drag_move_cb);
-       ewl_callback_del(w, EWL_CALLBACK_MOUSE_UP, ewl_widget_drag_up_cb);
-
-       /*
-        * First remove the parents reference to this widget to avoid bad
-        * references.
-        */
-       if (w->parent)
-               ewl_container_child_remove(EWL_CONTAINER(w->parent), w);
-
-       ewl_widget_unrealize(w);
-
        /* 
         * cleanup the attachment lists 
         */
@@ -2027,18 +2039,6 @@
                ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
                ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_COLOR);
                ewl_attach_list_del(w->attach, EWL_ATTACH_TYPE_NAME);
-       }
-
-       /*
-        * Clear out the callbacks, this is a bit tricky because we don't want
-        * to continue using this widget after the callbacks have been
-        * deleted. Clear all callbacks except for the destroy callbacks.
-        * This preserves the list of the destroy type so we don't get a 
segfault.
-        */
-       for (i = 0; i < EWL_CALLBACK_MAX; i++)
-       {
-               if (i == EWL_CALLBACK_DESTROY) continue;
-               ewl_callback_del_type(w, i);
        }
 
        /*




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to