Merge lp:~3v1n0/unity/ups-delete-dropdown-entries into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4024
Proposed branch: lp:~3v1n0/unity/ups-delete-dropdown-entries
Merge into: lp:unity
Diff against target: 84 lines (+34/-5)
1 file modified
services/panel-service.c (+34/-5)
To merge this branch: bzr merge lp:~3v1n0/unity/ups-delete-dropdown-entries
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+273558@code.launchpad.net

Commit message

PanelService: ensure that we free the "fake" IndicatorEntry's we create for dropdowns

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'services/panel-service.c'
2--- services/panel-service.c 2015-10-01 17:17:15 +0000
3+++ services/panel-service.c 2015-10-12 16:14:05 +0000
4@@ -270,6 +270,12 @@
5 y >= rect->y && y <= (rect->y + rect->height));
6 }
7
8+gboolean
9+entry_has_dropdown_id (const gchar *entry_id)
10+{
11+ return g_str_has_suffix (entry_id, "-dropdown");
12+}
13+
14 IndicatorObjectEntry *
15 get_entry_at (PanelService *self, gint x, gint y)
16 {
17@@ -413,7 +419,7 @@
18 }
19 }
20
21- if (!entry && g_str_has_suffix (entry_id, "-dropdown"))
22+ if (!entry && entry_has_dropdown_id (entry_id))
23 {
24 /* Unity might register some "fake" dropdown entries that it might use to
25 * to present long menu bars (right now only for appmenu indicator) */
26@@ -421,6 +427,8 @@
27 entry->parent_object = self->priv->appmenu_indicator;
28 entry->name_hint = g_strdup (entry_id);
29 self->priv->dropdown_entries = g_slist_append (self->priv->dropdown_entries, entry);
30+
31+ /* Now the Hashtable owns the name_hint, so no need to manually free it */
32 g_hash_table_insert (self->priv->id2entry_hash, (gpointer)entry->name_hint, entry);
33 }
34
35@@ -909,6 +917,7 @@
36 gchar *entry_id;
37 GHashTableIter iter;
38 gpointer key, value;
39+ GSList *ll;
40
41 entry = l->data;
42
43@@ -922,9 +931,18 @@
44 g_signal_handlers_disconnect_by_data (entry->image, indicator);
45 }
46
47- entry_id = get_indicator_entry_id_by_entry (entry);
48- g_hash_table_remove (self->priv->id2entry_hash, entry_id);
49- g_free (entry_id);
50+ if ((ll = g_slist_find (self->priv->dropdown_entries, entry)))
51+ {
52+ self->priv->dropdown_entries = g_slist_delete_link (self->priv->dropdown_entries, ll);
53+ g_hash_table_remove (self->priv->id2entry_hash, entry->name_hint);
54+ g_free (entry);
55+ }
56+ else
57+ {
58+ entry_id = get_indicator_entry_id_by_entry (entry);
59+ g_hash_table_remove (self->priv->id2entry_hash, entry_id);
60+ g_free (entry_id);
61+ }
62
63 g_hash_table_iter_init (&iter, self->priv->panel2entries_hash);
64 while (g_hash_table_iter_next (&iter, &key, &value))
65@@ -1939,7 +1957,18 @@
66 if (width < 0 || height < 0 || !valid_entry)
67 {
68 if (valid_entry)
69- ensure_entry_menu_is_closed (self, panel_id, entry);
70+ {
71+ GSList *l;
72+ ensure_entry_menu_is_closed (self, panel_id, entry);
73+
74+ if ((l = g_slist_find (self->priv->dropdown_entries, entry)))
75+ {
76+ valid_entry = FALSE;
77+ self->priv->dropdown_entries = g_slist_delete_link (self->priv->dropdown_entries, l);
78+ g_hash_table_remove (self->priv->id2entry_hash, entry->name_hint);
79+ g_free (entry);
80+ }
81+ }
82
83 if (entry2geometry_hash)
84 {