Merge lp:~toabctl/overlay-scrollbar/fix-1058205-for-ubuntu into lp:~ubuntu-desktop/overlay-scrollbar/ubuntu

Proposed by Thomas Bechtold
Status: Merged
Merged at revision: 200
Proposed branch: lp:~toabctl/overlay-scrollbar/fix-1058205-for-ubuntu
Merge into: lp:~ubuntu-desktop/overlay-scrollbar/ubuntu
Diff against target: 164 lines (+71/-48)
2 files modified
debian/changelog (+6/-0)
os/os-scrollbar.c (+65/-48)
To merge this branch: bzr merge lp:~toabctl/overlay-scrollbar/fix-1058205-for-ubuntu
Reviewer Review Type Date Requested Status
Ubuntu Desktop Pending
Review via email: mp+128099@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-09-25 11:13:24 +0000
3+++ debian/changelog 2012-10-04 19:44:21 +0000
4@@ -1,3 +1,9 @@
5+overlay-scrollbar (0.2.16+r357-0ubuntu1) UNRELEASED; urgency=low
6+
7+ * Updated to r357, fixes memory leak (lp: #1058205)
8+
9+ -- Thomas Bechtold <thomasbechtold@jpberlin.de> Thu, 04 Oct 2012 21:36:57 +0200
10+
11 overlay-scrollbar (0.2.16+r356-0ubuntu2) quantal-proposed; urgency=low
12
13 * Reuploaded now that gtk2 has a fix for it
14
15=== modified file 'os/os-scrollbar.c'
16--- os/os-scrollbar.c 2012-09-24 14:25:40 +0000
17+++ os/os-scrollbar.c 2012-10-04 19:44:21 +0000
18@@ -609,14 +609,28 @@
19 }
20 #endif
21
22-/* Get the private struct. */
23+/* destroy the private struct */
24+static void
25+destroy_private (gpointer priv)
26+{
27+ g_slice_free (OsScrollbarPrivate, priv);
28+}
29+
30+/* Get the private struct. If there isn't one, return NULL */
31+static OsScrollbarPrivate*
32+lookup_private (GtkWidget *widget)
33+{
34+ return g_object_get_qdata (G_OBJECT (widget), os_quark_qdata);
35+}
36+
37+/* Get the private struct. If there isn't one, create it */
38 static OsScrollbarPrivate*
39 get_private (GtkWidget *widget)
40 {
41 OsScrollbarPrivate *priv;
42
43 /* Fetch the private qdata struct. */
44- priv = g_object_get_qdata (G_OBJECT (widget), os_quark_qdata);
45+ priv = lookup_private (widget);
46
47 if (!priv)
48 {
49@@ -667,7 +681,7 @@
50 scrolling_cb, scrolling_end_cb, widget);
51
52 /* Store qdata. */
53- g_object_set_qdata (G_OBJECT (widget), os_quark_qdata, qdata);
54+ g_object_set_qdata_full (G_OBJECT (widget), os_quark_qdata, qdata, destroy_private);
55 priv = qdata;
56
57 /* Create adjustment and thumb. */
58@@ -3175,31 +3189,6 @@
59 OsScrollbarPrivate *priv;
60
61 scrollbar = GTK_SCROLLBAR (object);
62- priv = get_private (GTK_WIDGET (scrollbar));
63-
64- if (priv->source_deactivate_bar_id != 0)
65- {
66- g_source_remove (priv->source_deactivate_bar_id);
67- priv->source_deactivate_bar_id = 0;
68- }
69-
70- if (priv->source_hide_thumb_id != 0)
71- {
72- g_source_remove (priv->source_hide_thumb_id);
73- priv->source_hide_thumb_id = 0;
74- }
75-
76- if (priv->source_show_thumb_id != 0)
77- {
78- g_source_remove (priv->source_show_thumb_id);
79- priv->source_show_thumb_id = 0;
80- }
81-
82- if (priv->source_unlock_thumb_id != 0)
83- {
84- g_source_remove (priv->source_unlock_thumb_id);
85- priv->source_unlock_thumb_id = 0;
86- }
87
88 os_root_list = g_slist_remove (os_root_list, scrollbar);
89
90@@ -3215,26 +3204,54 @@
91 root_filter_func, NULL);
92 }
93
94- if (priv->animation != NULL)
95- {
96- g_object_unref (priv->animation);
97- priv->animation = NULL;
98- }
99-
100- if (priv->bar != NULL)
101- {
102- g_object_unref (priv->bar);
103- priv->bar = NULL;
104- }
105-
106- if (priv->window_group != NULL)
107- {
108- g_object_unref (priv->window_group);
109- priv->window_group = NULL;
110- }
111-
112- swap_adjustment (scrollbar, NULL);
113- swap_thumb (scrollbar, NULL);
114+ priv = lookup_private (GTK_WIDGET(scrollbar));
115+ if (priv != NULL)
116+ {
117+ if (priv->source_deactivate_bar_id != 0)
118+ {
119+ g_source_remove (priv->source_deactivate_bar_id);
120+ priv->source_deactivate_bar_id = 0;
121+ }
122+
123+ if (priv->source_hide_thumb_id != 0)
124+ {
125+ g_source_remove (priv->source_hide_thumb_id);
126+ priv->source_hide_thumb_id = 0;
127+ }
128+
129+ if (priv->source_show_thumb_id != 0)
130+ {
131+ g_source_remove (priv->source_show_thumb_id);
132+ priv->source_show_thumb_id = 0;
133+ }
134+
135+ if (priv->source_unlock_thumb_id != 0)
136+ {
137+ g_source_remove (priv->source_unlock_thumb_id);
138+ priv->source_unlock_thumb_id = 0;
139+ }
140+
141+ if (priv->animation != NULL)
142+ {
143+ g_object_unref (priv->animation);
144+ priv->animation = NULL;
145+ }
146+
147+ if (priv->bar != NULL)
148+ {
149+ g_object_unref (priv->bar);
150+ priv->bar = NULL;
151+ }
152+
153+ if (priv->window_group != NULL)
154+ {
155+ g_object_unref (priv->window_group);
156+ priv->window_group = NULL;
157+ }
158+
159+ swap_adjustment (scrollbar, NULL);
160+ swap_thumb (scrollbar, NULL);
161+ }
162 }
163
164 (* pre_hijacked_scrollbar_dispose) (object);

Subscribers

People subscribed via source and target branches