Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_imenu.c ewl_imenu.h ewl_menu.c ewl_menu.h 


Log Message:
- it is possible to have the menu widget deleted before the popup widget.
  this can cause errors as the popup destroy will access the menu widget.
  this fixes it by removing the popup_destroy cb if the menu is destroyed as
  we don't have to worry about setting menu->base.popup to NULL in that case

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_imenu.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_imenu.c 21 May 2006 03:51:41 -0000      1.10
+++ ewl_imenu.c 25 May 2006 04:38:18 -0000      1.11
@@ -64,6 +64,9 @@
                                   EWL_FLAG_FILL_NONE);
        ewl_object_alignment_set(EWL_OBJECT(menu->base.popup),
                                 EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
+
+       ewl_callback_prepend(EWL_WIDGET(menu), EWL_CALLBACK_DESTROY,
+                               ewl_imenu_destroy_cb, NULL);
        ewl_callback_prepend(menu->base.popup, EWL_CALLBACK_DESTROY,
                                ewl_imenu_popup_destroy_cb, menu);
 
@@ -129,6 +132,23 @@
 
        menu = data;
        if (menu->base.popup) menu->base.popup = NULL;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void
+ewl_imenu_destroy_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
+{
+       Ewl_Imenu *menu;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
+
+       menu = EWL_IMENU(w);
+       if (menu->base.popup)
+               ewl_callback_del(menu->base.popup, EWL_CALLBACK_DESTROY, 
+                                               ewl_imenu_popup_destroy_cb);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_imenu.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_imenu.h 15 Mar 2006 04:03:48 -0000      1.9
+++ ewl_imenu.h 25 May 2006 04:38:18 -0000      1.10
@@ -48,6 +48,7 @@
  */
 void ewl_imenu_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_imenu_expand_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_imenu_destroy_cb(Ewl_Widget *w, void *ev, void *data);
 void ewl_imenu_popup_destroy_cb(Ewl_Widget *w, void *ev, void *data);
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_menu.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- ewl_menu.c  24 May 2006 02:55:15 -0000      1.30
+++ ewl_menu.c  25 May 2006 04:38:18 -0000      1.31
@@ -78,7 +78,9 @@
 
        ewl_callback_append(menu->base.popup, EWL_CALLBACK_MOUSE_MOVE,
                                ewl_menu_mouse_move_cb, menu);
-                           
+                          
+       ewl_callback_prepend(EWL_WIDGET(menu), EWL_CALLBACK_DESTROY,
+                               ewl_menu_destroy_cb, NULL);
        ewl_callback_prepend(menu->base.popup, EWL_CALLBACK_DESTROY,
                                ewl_menu_popup_destroy_cb, menu);
 
@@ -277,6 +279,23 @@
 
        m = data;
        if (m->base.popup) m->base.popup = NULL;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void
+ewl_menu_destroy_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
+{
+       Ewl_Menu *menu;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
+
+       menu = EWL_MENU(w);
+       if (menu->base.popup)
+               ewl_callback_del(menu->base.popup, EWL_CALLBACK_DESTROY, 
+                                               ewl_menu_popup_destroy_cb);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_menu.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ewl_menu.h  15 Mar 2006 04:03:48 -0000      1.13
+++ ewl_menu.h  25 May 2006 04:38:18 -0000      1.14
@@ -55,6 +55,7 @@
 void ewl_menu_expand_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_menu_popup_move_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_menu_hide_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_menu_destroy_cb(Ewl_Widget *w, void *ev, void *data);
 void ewl_menu_popup_destroy_cb(Ewl_Widget *w, void *ev, void *data);
 void ewl_menu_expand_mouse_move_cb(Ewl_Widget *w, void *ev_data, void 
*user_data);
 void ewl_menu_mouse_move_cb(Ewl_Widget *w, void *ev_data, void *user_data);




-------------------------------------------------------
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