Merge lp:~mterry/indicator-appmenu/one-too-many-refs into lp:indicator-appmenu/0.3

Proposed by Michael Terry
Status: Merged
Merged at revision: 130
Proposed branch: lp:~mterry/indicator-appmenu/one-too-many-refs
Merge into: lp:indicator-appmenu/0.3
Diff against target: 37 lines (+4/-4)
2 files modified
src/Makefile.am (+2/-2)
src/window-menus.c (+2/-2)
To merge this branch: bzr merge lp:~mterry/indicator-appmenu/one-too-many-refs
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+76809@code.launchpad.net

Description of the change

In the course of tracking down the memory in bug 835646, I found this leak. It fixes part of the problem, but seemingly not all of it.

The problem here is that a ref is made before a call, thinking the call will unref it. But it doesn't. The call does a ref/unref pair.

(it's slightly more complicated than that. the call thinks that by disconnecting a signal, it will unref a ref that it expects to be made by the outer function (thus, reffing once and unreffing twice) -- but this particular code path doesn't do that, so the outer function ref isn't needed)

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

(and I threw in a Makefile.am fix for free)

129. By Michael Terry

don't add an extra ref for new menuitems

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2011-01-12 23:59:56 +0000
+++ src/Makefile.am 2011-09-23 21:05:15 +0000
@@ -45,14 +45,14 @@
4545
46gen-%.xml.c: %.xml46gen-%.xml.c: %.xml
47 @echo "Building $@ from $<"47 @echo "Building $@ from $<"
48 @echo "const char * _$(subst -,_,$(subst .,_,$(basename $<))) = " > $@48 @echo "const char * _$(subst -,_,$(subst .,_,$(basename $(notdir $<)))) = " > $@
49 @$(XSLT_PROC) $(srcdir)/clean-namespaces.xslt $< | \49 @$(XSLT_PROC) $(srcdir)/clean-namespaces.xslt $< | \
50 sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": >> $@50 sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": >> $@
51 @echo ";" >> $@51 @echo ";" >> $@
5252
53gen-%.xml.h: %.xml53gen-%.xml.h: %.xml
54 @echo "Building $@ from $<"54 @echo "Building $@ from $<"
55 @echo "extern const char * _$(subst -,_,$(subst .,_,$(basename $<)));" > $@55 @echo "extern const char * _$(subst -,_,$(subst .,_,$(basename $(notdir $<))));" > $@
5656
57BUILT_SOURCES += \57BUILT_SOURCES += \
58 gen-application-menu-renderer.xml.c \58 gen-application-menu-renderer.xml.c \
5959
=== modified file 'src/window-menus.c'
--- src/window-menus.c 2011-06-07 19:38:59 +0000
+++ src/window-menus.c 2011-09-23 21:05:15 +0000
@@ -669,10 +669,10 @@
669 } else {669 } else {
670 gpointer * data = g_new(gpointer, 2);670 gpointer * data = g_new(gpointer, 2);
671 data[0] = user_data;671 data[0] = user_data;
672 data[1] = g_object_ref(newentry);672 data[1] = newentry;
673 /* child_realized does an unref */
674673
675 menu_child_realized(NULL, data);674 menu_child_realized(NULL, data);
675 g_free (data);
676 }676 }
677 677
678 return;678 return;

Subscribers

People subscribed via source and target branches