Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_menu_base.c ewl_widget.c ewl_widget.h 


Log Message:
- fix memory leak.
    - make sure the ->popbox gets destroyed if it hasn't been parented yet.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_menu_base.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- ewl_menu_base.c     16 Nov 2006 22:09:00 -0000      1.21
+++ ewl_menu_base.c     29 Dec 2006 18:24:59 -0000      1.22
@@ -243,6 +243,12 @@
        DCHECK_TYPE("w", w, EWL_MENU_BASE_TYPE);
 
        menu = EWL_MENU_BASE(w);
+
+       /* we need to destroy the popbox if it hasn't been parented yet */
+       if (menu->popbox && !DESTROYED(menu->popbox) 
+                       && !ewl_widget_parent_get(menu->popbox))
+               ewl_widget_destroy(menu->popbox);
+
        if (menu->popup)
                ewl_widget_destroy(menu->popup);
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -3 -r1.109 -r1.110
--- ewl_widget.c        11 Dec 2006 23:16:50 -0000      1.109
+++ ewl_widget.c        29 Dec 2006 18:24:59 -0000      1.110
@@ -799,6 +799,21 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+/**
+ * @param w: The widget to get the parent from 
+ * @return Returns the parent of the given widget, or NULL if none set
+ * @brief Retrieves the parent of the given widget
+ */
+Ewl_Widget *
+ewl_widget_parent_get(Ewl_Widget *w)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("w", w, NULL);
+       DCHECK_TYPE_RET("w", w, EWL_WIDGET_TYPE, NULL);
+
+       DRETURN_PTR(w->parent, DLEVEL_STABLE);
+}
+
 /**     
  * @param w: the widget whose text to change
  * @param part: the theme part name whose text to change
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- ewl_widget.h        6 Dec 2006 20:14:53 -0000       1.50
+++ ewl_widget.h        29 Dec 2006 18:24:59 -0000      1.51
@@ -193,6 +193,7 @@
 unsigned int    ewl_widget_onscreen_is(Ewl_Widget *widget);
 
 void            ewl_widget_parent_set(Ewl_Widget *w, Ewl_Widget *p);
+Ewl_Widget     *ewl_widget_parent_get(Ewl_Widget *w);
 
 void            ewl_widget_enable(Ewl_Widget *w);
 void            ewl_widget_disable(Ewl_Widget *w);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to