Merge lp:~ted/libindicator/lp719457 into lp:libindicator/0.5

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 456
Merge reported by: Charles Kerr
Merged at revision: not available
Proposed branch: lp:~ted/libindicator/lp719457
Merge into: lp:libindicator/0.5
Diff against target: 14 lines (+3/-1)
1 file modified
libindicator/indicator-service.c (+3/-1)
To merge this branch: bzr merge lp:~ted/libindicator/lp719457
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+95619@code.launchpad.net

Description of the change

Saving the string before doing the remove so the string being free'd doesn't effect us.

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) wrote :

libindicator doesn't appear to be violating the glib API -- this smells like a bug in GHashTable that we'd be better off reporting upstream instead of using a local band-aid.

Also, nobody's reported this since March 16 last year, and glib has revved several times since then. Maybe it would make sense to CC desrt to see if that valgrind log looks familiar?

Revision history for this message
Ted Gould (ted) wrote :

On Sun, 2012-03-04 at 21:34 +0000, charles wrote:
> libindicator doesn't appear to be violating the glib API -- this
> smells like a bug in GHashTable that we'd be better off reporting
> upstream instead of using a local band-aid.
>
> Also, nobody's reported this since March 16 last year, and glib has
> revved several times since then. Maybe it would make sense to CC desrt
> to see if that valgrind log looks familiar?

I actually don't think it's a bug in the hashtable, it's that the remove
in the hashtable us causing an unwatch to be called, which is freeing
the datastructure with the string. It is something that is likely to be
difficult to fix in GDBus as it would have to then queue the destruction
of the data structure until the current call stack returns. Since
that's a non-trivial change, I figured it would be worth working around.

Revision history for this message
Charles Kerr (charlesk) wrote :

Oh, okay. Thanks for the walkthrough Ted :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libindicator/indicator-service.c'
2--- libindicator/indicator-service.c 2011-07-14 18:08:31 +0000
3+++ libindicator/indicator-service.c 2012-03-02 16:58:21 +0000
4@@ -588,7 +588,9 @@
5 /* Remove us from the watcher list here */
6 gpointer watcher_item = g_hash_table_lookup(priv->watchers, name);
7 if (watcher_item != NULL) {
8- g_hash_table_remove(priv->watchers, name);
9+ gchar * safe_name = g_strdup(name);
10+ g_hash_table_remove(priv->watchers, safe_name);
11+ g_free(safe_name);
12 } else {
13 /* Odd that we couldn't find the person, but, eh */
14 g_warning("Unable to find watcher who is unwatching: %s", name);

Subscribers

People subscribed via source and target branches