Merge lp:~azzar1/compiz/fix-1214459-0.9.10 into lp:compiz/0.9.10

Proposed by Andrea Azzarone
Status: Merged
Approved by: Christopher Townsend
Approved revision: 3779
Merged at revision: 3779
Proposed branch: lp:~azzar1/compiz/fix-1214459-0.9.10
Merge into: lp:compiz/0.9.10
Diff against target: 238 lines (+25/-39)
9 files modified
src/eventsource.cpp (+2/-3)
src/privateeventsource.h (+1/-3)
src/privateiosource.h (+1/-3)
src/privatescreen.h (+6/-9)
src/screen.cpp (+8/-10)
src/timer/src/privatetimeoutsource.h (+1/-1)
src/timer/src/timer.cpp (+2/-6)
src/timer/tests/test-timer.h (+1/-1)
tests/integration/glib/glib_integration_test.cpp (+3/-3)
To merge this branch: bzr merge lp:~azzar1/compiz/fix-1214459-0.9.10
Reviewer Review Type Date Requested Status
Christopher Townsend Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+181114@code.launchpad.net

Commit message

Use Glib::RefPtr<Glib::Source> in glib_integration_test and compiz core too. After the fix of bug https://bugzilla.gnome.org/show_bug.cgi?id=561885 Glib::Source::~Source is called when both Source::unreference() and SourceCallbackData::destroy_notify_callback() are called.

Description of the change

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

LGTM and definitely needed for landing 0.9.10.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/eventsource.cpp'
2--- src/eventsource.cpp 2012-12-02 17:41:42 +0000
3+++ src/eventsource.cpp 2013-08-20 18:05:33 +0000
4@@ -27,11 +27,10 @@
5 #include "privateeventsource.h"
6 #include "core/screen.h"
7
8-CompEventSource *
9+Glib::RefPtr<CompEventSource>
10 CompEventSource::create ()
11 {
12- return new CompEventSource (screen->dpy (),
13- ConnectionNumber (screen->dpy ()));
14+ return Glib::RefPtr<CompEventSource> (new CompEventSource (screen->dpy (), ConnectionNumber (screen->dpy ())));
15 }
16
17 sigc::connection
18
19=== modified file 'src/privateeventsource.h'
20--- src/privateeventsource.h 2012-12-02 12:06:02 +0000
21+++ src/privateeventsource.h 2013-08-20 18:05:33 +0000
22@@ -37,9 +37,7 @@
23
24 virtual ~CompEventSource ();
25
26- static
27- CompEventSource *
28- create ();
29+ static Glib::RefPtr<CompEventSource> create ();
30
31 sigc::connection connect (const sigc::slot <bool> &slot);
32
33
34=== modified file 'src/privateiosource.h'
35--- src/privateiosource.h 2012-12-02 12:06:02 +0000
36+++ src/privateiosource.h 2013-08-20 18:05:33 +0000
37@@ -47,9 +47,7 @@
38 virtual ~CompWatchFd ();
39
40 static
41- CompWatchFd * create (int,
42- Glib::IOCondition,
43- FdWatchCallBack);
44+ Glib::RefPtr<CompWatchFd> create (int, Glib::IOCondition, FdWatchCallBack);
45
46 protected:
47
48
49=== modified file 'src/privatescreen.h'
50--- src/privatescreen.h 2013-05-12 08:20:10 +0000
51+++ src/privatescreen.h 2013-08-20 18:05:33 +0000
52@@ -314,14 +314,11 @@
53
54 Glib::RefPtr <Glib::MainLoop> mainloop;
55
56- /* We cannot use RefPtrs. See
57- * https://bugzilla.gnome.org/show_bug.cgi?id=561885
58- */
59- CompEventSource * source;
60- CompTimeoutSource * timeout;
61- CompSignalSource * sighupSource;
62- CompSignalSource * sigtermSource;
63- CompSignalSource * sigintSource;
64+ Glib::RefPtr <CompEventSource> source;
65+ Glib::RefPtr <CompTimeoutSource> timeout;
66+ CompSignalSource *sighupSource;
67+ CompSignalSource *sigtermSource;
68+ CompSignalSource *sigintSource;
69 Glib::RefPtr <Glib::MainContext> ctx;
70
71 CompFileWatchList fileWatch;
72@@ -329,7 +326,7 @@
73
74 // TODO - almost certainly the wrong data structure
75 // Why not a std::map<CompWatchFdHandle, CompWatchFd>?
76- std::list< CompWatchFd * > watchFds;
77+ std::list<Glib::RefPtr<CompWatchFd> > watchFds;
78 CompWatchFdHandle lastWatchFdHandle;
79
80 bool grabbed; /* true once we receive a GrabNotify
81
82=== modified file 'src/screen.cpp'
83--- src/screen.cpp 2013-05-13 13:27:30 +0000
84+++ src/screen.cpp 2013-08-20 18:05:33 +0000
85@@ -272,12 +272,12 @@
86 {
87 }
88
89-CompWatchFd *
90+Glib::RefPtr<CompWatchFd>
91 CompWatchFd::create (int fd,
92 Glib::IOCondition events,
93 FdWatchCallBack callback)
94 {
95- return new CompWatchFd (fd, events, callback);
96+ return Glib::RefPtr<CompWatchFd> (new CompWatchFd (fd, events, callback));
97 }
98
99 CompWatchFdHandle
100@@ -308,7 +308,7 @@
101 if (events & POLLHUP)
102 gEvents |= Glib::IO_HUP;
103
104- CompWatchFd *watchFd = CompWatchFd::create (fd, gEvents, callBack);
105+ Glib::RefPtr<CompWatchFd> watchFd = CompWatchFd::create (fd, gEvents, callBack);
106
107 watchFd->attach (ctx);
108
109@@ -333,8 +333,8 @@
110 void
111 cps::EventManager::removeWatchFd (CompWatchFdHandle handle)
112 {
113- std::list<CompWatchFd * >::iterator it;
114- CompWatchFd * w;
115+ std::list<Glib::RefPtr<CompWatchFd> >::iterator it;
116+ Glib::RefPtr<CompWatchFd> w;
117
118 for (it = watchFds.begin();
119 it != watchFds.end (); ++it)
120@@ -354,7 +354,6 @@
121 return;
122 }
123
124- delete w;
125 watchFds.erase (it);
126 }
127
128@@ -5271,10 +5270,10 @@
129 /* Not guaranteed to be created by EventManager's constructor */
130 if (timeout)
131 {
132- /* This will implicitly call ~CompTimeoutSource
133- * See LP: #1085590 */
134+
135 g_source_destroy (timeout->gobj ());
136 }
137+
138 delete sigintSource;
139 delete sigtermSource;
140 delete sighupSource;
141@@ -5282,12 +5281,11 @@
142 /* Not guaranteed to be created by EventManager's constructor */
143 if (source)
144 {
145- /* This will implicitly call ~CompEventSource */
146 g_source_destroy (source->gobj ());
147 }
148
149 /* This will implicitly call ~CompWatchFd */
150- foreach (CompWatchFd *fd, watchFds)
151+ foreach (Glib::RefPtr<CompWatchFd> fd, watchFds)
152 g_source_destroy (fd->gobj ());
153
154 watchFds.clear ();
155
156=== modified file 'src/timer/src/privatetimeoutsource.h'
157--- src/timer/src/privatetimeoutsource.h 2012-12-02 12:06:02 +0000
158+++ src/timer/src/privatetimeoutsource.h 2013-08-20 18:05:33 +0000
159@@ -37,7 +37,7 @@
160
161 virtual ~CompTimeoutSource ();
162
163- static CompTimeoutSource * create (Glib::RefPtr <Glib::MainContext> &ctx);
164+ static Glib::RefPtr<CompTimeoutSource> create (Glib::RefPtr <Glib::MainContext> &ctx);
165 sigc::connection connect (const sigc::slot <bool> &slot);
166
167 protected:
168
169=== modified file 'src/timer/src/timer.cpp'
170--- src/timer/src/timer.cpp 2012-09-05 13:04:40 +0000
171+++ src/timer/src/timer.cpp 2013-08-20 18:05:33 +0000
172@@ -56,10 +56,6 @@
173 set_priority (G_PRIORITY_DEFAULT);
174 attach (ctx);
175
176- /* We have to unreference the source so that it is destroyed
177- * when the main context destroys it */
178- unreference ();
179-
180 connect (sigc::mem_fun <bool, CompTimeoutSource> (this, &CompTimeoutSource::callback));
181 }
182
183@@ -73,10 +69,10 @@
184 return connect_generic (slot);
185 }
186
187-CompTimeoutSource *
188+Glib::RefPtr<CompTimeoutSource>
189 CompTimeoutSource::create (Glib::RefPtr <Glib::MainContext> &ctx)
190 {
191- return new CompTimeoutSource (ctx);
192+ return Glib::RefPtr<CompTimeoutSource> (new CompTimeoutSource (ctx));
193 }
194
195 static const unsigned short COMPIZ_TIMEOUT_WAIT = 15;
196
197=== modified file 'src/timer/tests/test-timer.h'
198--- src/timer/tests/test-timer.h 2012-07-27 07:18:40 +0000
199+++ src/timer/tests/test-timer.h 2013-08-20 18:05:33 +0000
200@@ -48,7 +48,7 @@
201
202 Glib::RefPtr <Glib::MainContext> mc;
203 Glib::RefPtr <Glib::MainLoop> ml;
204- CompTimeoutSource *ts;
205+ Glib::RefPtr <CompTimeoutSource> ts;
206 std::deque <CompTimer *> timers;
207
208 int lastTimerTriggered;
209
210=== modified file 'tests/integration/glib/glib_integration_test.cpp'
211--- tests/integration/glib/glib_integration_test.cpp 2012-12-02 17:43:53 +0000
212+++ tests/integration/glib/glib_integration_test.cpp 2013-08-20 18:05:33 +0000
213@@ -119,7 +119,7 @@
214
215 TEST_F (GLibSourceDestroyIntegration, TimeoutSourceGSourceDestroy)
216 {
217- StubTimeoutSource *sts = new StubTimeoutSource (&die, context);
218+ Glib::RefPtr<StubTimeoutSource> sts(new StubTimeoutSource (&die, context));
219
220 EXPECT_CALL (die, Die ());
221
222@@ -128,7 +128,7 @@
223
224 TEST_F (GLibSourceDestroyIntegration, EventSourceGSourceDestroy)
225 {
226- StubEventSource *sts = new StubEventSource (&die);
227+ Glib::RefPtr<StubEventSource> sts(new StubEventSource (&die));
228
229 sts->attach (context);
230
231@@ -142,7 +142,7 @@
232 Glib::IOCondition iocond = Glib::IO_IN;
233 int fd = 0;
234 FdWatchCallBack cb;
235- StubWatchFd *sts = new StubWatchFd (&die, fd, iocond, cb);
236+ Glib::RefPtr<StubWatchFd> sts(new StubWatchFd (&die, fd, iocond, cb));
237
238 sts->attach (context);
239

Subscribers

People subscribed via source and target branches