Merge lp:~alan-griffiths/compiz-core/fix-leaks into lp:compiz-core/0.9.5

Proposed by Alan Griffiths
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 2981
Merged at revision: 2981
Proposed branch: lp:~alan-griffiths/compiz-core/fix-leaks
Merge into: lp:compiz-core/0.9.5
Diff against target: 175 lines (+23/-52)
7 files modified
plugins/composite/tests/paintscheduler/test-paintscheduler.cpp (+1/-3)
plugins/regex/src/regexplugin.h (+3/-2)
src/pluginclasshandler/include/core/valueholder.h (+4/-1)
src/pluginclasshandler/src/valueholder.cpp (+5/-0)
src/pluginclasshandler/src/valueholder.h (+0/-41)
src/timer/include/core/timeouthandler.h (+3/-2)
src/timer/src/timeouthandler.cpp (+7/-3)
To merge this branch: bzr merge lp:~alan-griffiths/compiz-core/fix-leaks
Reviewer Review Type Date Requested Status
Compiz Maintainers Pending
Review via email: mp+91472@code.launchpad.net

Description of the change

Fix a couple of memory leaks

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Oh, and remove spurious file: src/pluginclasshandler/src/valueholder.h

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/composite/tests/paintscheduler/test-paintscheduler.cpp'
2--- plugins/composite/tests/paintscheduler/test-paintscheduler.cpp 2012-01-25 07:33:33 +0000
3+++ plugins/composite/tests/paintscheduler/test-paintscheduler.cpp 2012-02-03 18:13:21 +0000
4@@ -727,8 +727,7 @@
5
6 gettimeofday (&SleepVBlankWaiter::start_time, NULL);
7
8- TimeoutHandler *th = new TimeoutHandler ();
9- TimeoutHandler::SetDefault (th);
10+ TimeoutHandler::SetDefault (new TimeoutHandler ());
11
12 Glib::RefPtr <Glib::MainContext> ctx = Glib::MainContext::get_default ();
13 Glib::RefPtr <Glib::MainLoop> mainloop = Glib::MainLoop::create (ctx, false);
14@@ -749,7 +748,6 @@
15 doTest ("vsync 100 Hz refresh rate", 100, 2.8f, true, mainloop);
16
17 delete timeout;
18- delete th;
19
20 return 0;
21 }
22
23=== modified file 'plugins/regex/src/regexplugin.h'
24--- plugins/regex/src/regexplugin.h 2012-01-18 16:26:45 +0000
25+++ plugins/regex/src/regexplugin.h 2012-02-03 18:13:21 +0000
26@@ -26,8 +26,9 @@
27 #ifndef COMPIZ_REGEXPLUGIN_H
28 #define COMPIZ_REGEXPLUGIN_H
29
30-#include <core/screen.h>
31-#include <core/pluginclasshandler.h>
32+#include "core/screen.h"
33+#include "core/timer.h"
34+#include "core/pluginclasshandler.h"
35
36 #include <X11/Xatom.h>
37
38
39=== modified file 'src/pluginclasshandler/include/core/valueholder.h'
40--- src/pluginclasshandler/include/core/valueholder.h 2012-01-12 06:48:58 +0000
41+++ src/pluginclasshandler/include/core/valueholder.h 2012-02-03 18:13:21 +0000
42@@ -30,13 +30,16 @@
43 #include <core/logmessage.h>
44 #include <core/privateunion.h>
45
46+#include <boost/noncopyable.hpp>
47+
48 class PrivateValueHolder;
49
50-class ValueHolder
51+class ValueHolder : boost::noncopyable
52 {
53 public:
54
55 ValueHolder ();
56+ ~ValueHolder ();
57
58 void eraseValue (CompString key);
59 bool hasValue (CompString key);
60
61=== modified file 'src/pluginclasshandler/src/valueholder.cpp'
62--- src/pluginclasshandler/src/valueholder.cpp 2012-01-12 06:48:58 +0000
63+++ src/pluginclasshandler/src/valueholder.cpp 2012-02-03 18:13:21 +0000
64@@ -43,6 +43,11 @@
65 {
66 }
67
68+ValueHolder::~ValueHolder ()
69+{
70+ delete priv;
71+}
72+
73 ValueHolder *
74 ValueHolder::Default ()
75 {
76
77=== removed file 'src/pluginclasshandler/src/valueholder.h'
78--- src/pluginclasshandler/src/valueholder.h 2012-01-12 06:48:58 +0000
79+++ src/pluginclasshandler/src/valueholder.h 1970-01-01 00:00:00 +0000
80@@ -1,41 +0,0 @@
81-/*
82- * Copyright © 2010 Canonical Ltd.
83- *
84- * Permission to use, copy, modify, distribute, and sell this software
85- * and its documentation for any purpose is hereby granted without
86- * fee, provided that the above copyright notice appear in all copies
87- * and that both that copyright notice and this permission notice
88- * appear in supporting documentation, and that the name of
89- * Canonical Ltd. not be used in advertising or publicity pertaining to
90- * distribution of the software without specific, written prior permission.
91- * Canonical Ltd. makes no representations about the suitability of this
92- * software for any purpose. It is provided "as is" without express or
93- * implied warranty.
94- *
95- * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
96- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
97- * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
98- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
99- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
100- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
101- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
102- *
103- * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
104- */
105-
106-class PrivateValueHolder;
107-
108-class ValueHolder
109-{
110- public:
111-
112- ValueHolder ();
113-
114- void hasValue (CompString key);
115- void storeValue (CompString key, CompPrivate value);
116- CompPrivate getValue (CompString key);
117-
118- private:
119-
120- PrivateValueHolder *priv;
121-};
122
123=== modified file 'src/timer/include/core/timeouthandler.h'
124--- src/timer/include/core/timeouthandler.h 2012-01-12 06:48:58 +0000
125+++ src/timer/include/core/timeouthandler.h 2012-02-03 18:13:21 +0000
126@@ -26,12 +26,13 @@
127 #ifndef _COMPIZ_TIMEOUTHANDLER_H
128 #define _COMPIZ_TIMEOUTHANDLER_H
129
130-#include <core/timer.h>
131+#include <boost/noncopyable.hpp>
132+#include <list>
133
134 class PrivateTimeoutHandler;
135 class CompTimer;
136
137-class TimeoutHandler
138+class TimeoutHandler : boost::noncopyable
139 {
140 public:
141
142
143=== modified file 'src/timer/src/timeouthandler.cpp'
144--- src/timer/src/timeouthandler.cpp 2012-01-12 06:48:58 +0000
145+++ src/timer/src/timeouthandler.cpp 2012-02-03 18:13:21 +0000
146@@ -25,10 +25,14 @@
147 */
148
149 #include "privatetimeouthandler.h"
150+#include "core/timer.h"
151+
152+#include <boost/scoped_ptr.hpp>
153+#include <algorithm>
154
155 namespace
156 {
157- static TimeoutHandler *gDefault;
158+ static boost::scoped_ptr<TimeoutHandler> gDefault;
159 }
160
161 TimeoutHandler::TimeoutHandler () :
162@@ -84,11 +88,11 @@
163 TimeoutHandler *
164 TimeoutHandler::Default ()
165 {
166- return gDefault;
167+ return gDefault.get();
168 }
169
170 void
171 TimeoutHandler::SetDefault (TimeoutHandler *instance)
172 {
173- gDefault = instance;
174+ gDefault.reset(instance);
175 }

Subscribers

People subscribed via source and target branches