Merge lp:~compiz-team/compiz/compiz.fix_1049169 into lp:compiz/0.9.8

Proposed by Sam Spilsbury on 2012-09-25
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1049169
Merge into: lp:compiz/0.9.8
Prerequisite: lp:~compiz-team/compiz/compiz.fix_1050796
Diff against target: 472 lines (+60/-209)
10 files modified
compizconfig/gsettings/src/gsettings.c (+2/-1)
compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp (+0/-17)
compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h (+2/-2)
compizconfig/gsettings/tests/test_gsettings_conformance.cpp (+0/-1)
compizconfig/gsettings/tests/test_gsettings_tests.h (+13/-8)
compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting_factory.h (+3/-0)
compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting_factory.c (+12/-0)
compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp (+26/-15)
compizconfig/libcompizconfig/src/bindings.c (+2/-2)
compizconfig/tests/compizconfig_ccs_list_wrapper.h (+0/-163)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1049169
Reviewer Review Type Date Requested Status
jenkins (community) continuous-integration Needs Fixing on 2012-09-25
Compiz Maintainers 2012-09-25 Pending
Review via email: mp+126163@code.launchpad.net

This proposal has been superseded by a proposal from 2012-09-25.

Commit message

Fixes memory leaks in the tests

Description of the change

Fixes memory leaks in the tests

To post a comment you must log in.
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Sam Spilsbury (smspillaz) wrote :

Seems to me like the above failure is probably caused by a missing file. Jenkins doesn't say too much about it, rebuilding locally to check

3392. By Sam Spilsbury on 2012-09-25

Merge compiz.fix_1050796

3393. By Sam Spilsbury on 2012-09-25

Merge lp:~compiz-team/compiz/compiz.fix_1050796

jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'compizconfig/gsettings/src/gsettings.c'
2--- compizconfig/gsettings/src/gsettings.c 2012-08-16 17:00:25 +0000
3+++ compizconfig/gsettings/src/gsettings.c 2012-09-25 08:46:22 +0000
4@@ -50,7 +50,8 @@
5 cleanSettingName,
6 pathName,
7 ccsSettingGetType (setting));
8-
9+ free (cleanSettingName);
10+ g_free (pathName);
11 return gsettingsValue;
12 }
13
14
15=== modified file 'compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp'
16--- compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp 2012-09-25 08:46:22 +0000
17+++ compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp 2012-09-25 08:46:22 +0000
18@@ -52,8 +52,6 @@
19
20 CCSGSettingsWrapper *mSettings;
21 std::string profileName;
22- CompizGLibGSettingsMemoryBackendTestingEnv gsettingsEnv;
23- CompizGLibGSliceOffEnv gsliceEnv;
24 };
25
26 void
27@@ -333,21 +331,6 @@
28 return shared;
29 }
30
31-void
32-CCSGSettingsStorageEnv::SetUp ()
33-{
34- g_type_init ();
35- priv->gsliceEnv.SetUpEnv ();
36- priv->gsettingsEnv.SetUpEnv (MOCK_PATH);
37-}
38-
39-void
40-CCSGSettingsStorageEnv::TearDown ()
41-{
42- priv->gsettingsEnv.TearDownEnv ();
43- priv->gsliceEnv.TearDownEnv ();
44-}
45-
46 PrivateCCSGSettingsStorageEnv::PrivateCCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
47 const std::string &profileName) :
48 mSettings (settings),
49
50=== modified file 'compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h'
51--- compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h 2012-09-25 08:46:22 +0000
52+++ compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h 2012-09-25 08:46:22 +0000
53@@ -40,8 +40,8 @@
54 {
55 public:
56
57- virtual void SetUp ();
58- virtual void TearDown ();
59+ virtual void SetUp () {}
60+ virtual void TearDown () {}
61
62 CCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
63 const std::string &profileName);
64
65=== modified file 'compizconfig/gsettings/tests/test_gsettings_conformance.cpp'
66--- compizconfig/gsettings/tests/test_gsettings_conformance.cpp 2012-09-25 08:46:22 +0000
67+++ compizconfig/gsettings/tests/test_gsettings_conformance.cpp 2012-09-25 08:46:22 +0000
68@@ -65,7 +65,6 @@
69 CCSGSettingsBackendEnv () :
70 pluginToMatch ("mock")
71 {
72- g_type_init ();
73 }
74
75 /* A wrapper to prevent signals from being added */
76
77=== modified file 'compizconfig/gsettings/tests/test_gsettings_tests.h'
78--- compizconfig/gsettings/tests/test_gsettings_tests.h 2012-09-25 08:46:22 +0000
79+++ compizconfig/gsettings/tests/test_gsettings_tests.h 2012-09-25 08:46:22 +0000
80@@ -45,13 +45,18 @@
81
82 virtual void SetUpEnv ()
83 {
84- setenv ("G_SLICE", "always-malloc", 1);
85+ gsliceEnv.SetUpEnv ();
86+ g_type_init ();
87 }
88
89 virtual void TearDownEnv ()
90 {
91- unsetenv ("G_SLICE");
92+ gsliceEnv.TearDownEnv ();
93 }
94+
95+ private:
96+
97+ CompizGLibGSliceOffEnv gsliceEnv;
98 };
99
100 class CCSGSettingsMemoryBackendTestingEnv :
101@@ -62,18 +67,18 @@
102 virtual void SetUpEnv ()
103 {
104 CCSGSettingsTestingEnv::SetUpEnv ();
105-
106- g_setenv ("GSETTINGS_SCHEMA_DIR", MOCK_PATH.c_str (), true);
107- g_setenv ("GSETTINGS_BACKEND", "memory", 1);
108+ gsettingsEnv.SetUpEnv (MOCK_PATH);
109 }
110
111 virtual void TearDownEnv ()
112 {
113- g_unsetenv ("GSETTINGS_BACKEND");
114- g_unsetenv ("GSETTINGS_SCHEMA_DIR");
115-
116+ gsettingsEnv.TearDownEnv ();
117 CCSGSettingsTestingEnv::TearDownEnv ();
118 }
119+
120+ private:
121+
122+ CompizGLibGSettingsMemoryBackendTestingEnv gsettingsEnv;
123 };
124
125 class CCSGSettingsTestCommon :
126
127=== modified file 'compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting_factory.h'
128--- compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting_factory.h 2012-09-25 08:46:22 +0000
129+++ compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting_factory.h 2012-09-25 08:46:22 +0000
130@@ -60,6 +60,9 @@
131 CCSGNOMEIntegrationGSettingsWrapperFactory *
132 ccsGNOMEIntegrationGSettingsWrapperDefaultImplNew (CCSObjectAllocationInterface *ai);
133
134+void
135+ccsGNOMEIntegrationGSettingsWrapperDefaultImplFree (CCSGNOMEIntegrationGSettingsWrapperFactory *wrapperFactory);
136+
137 CCSIntegratedSettingFactory *
138 ccsGSettingsIntegratedSettingFactoryNew (CCSGNOMEIntegrationGSettingsWrapperFactory *wrapperFactory,
139 CCSGNOMEValueChangeData *data,
140
141=== modified file 'compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting_factory.c'
142--- compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting_factory.c 2012-09-25 08:46:22 +0000
143+++ compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting_factory.c 2012-09-25 08:46:22 +0000
144@@ -79,6 +79,14 @@
145 ccsGNOMEIntegrationGSettingsWrapperFactoryNewGSettingsWrapperDefault
146 };
147
148+void
149+ccsGNOMEIntegrationGSettingsWrapperDefaultImplFree (CCSGNOMEIntegrationGSettingsWrapperFactory *wrapperFactory)
150+{
151+ ccsObjectFinalize (wrapperFactory);
152+ (*wrapperFactory->object.object_allocation->free_) (wrapperFactory->object.object_allocation->allocator,
153+ wrapperFactory);
154+}
155+
156 CCSGNOMEIntegrationGSettingsWrapperFactory *
157 ccsGNOMEIntegrationGSettingsWrapperDefaultImplNew (CCSObjectAllocationInterface *ai)
158 {
159@@ -279,6 +287,8 @@
160 if (priv->pluginsToSettingNameGNOMENameHashTable)
161 g_hash_table_unref (priv->pluginsToSettingNameGNOMENameHashTable);
162
163+ ccsGNOMEIntegrationGSettingsWrapperDefaultImplFree (priv->wrapperFactory);
164+
165 ccsObjectFinalize (factory);
166 (*factory->object.object_allocation->free_) (factory->object.object_allocation->allocator, factory);
167 }
168@@ -318,6 +328,8 @@
169 ccsObjectSetPrivate (factory, (CCSPrivate *) priv);
170 ccsObjectAddInterface (factory, (const CCSInterface *) &ccsGSettingsIntegratedSettingFactoryInterface, GET_INTERFACE_TYPE (CCSIntegratedSettingFactoryInterface));
171
172+ ccsObjectRef (factory);
173+
174 return factory;
175 }
176
177
178=== modified file 'compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp'
179--- compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp 2012-09-25 08:46:22 +0000
180+++ compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp 2012-09-25 08:46:22 +0000
181@@ -43,6 +43,7 @@
182 using ::testing::ValuesIn;
183 using ::testing::Values;
184 using ::testing::Eq;
185+using ::testing::WithArgs;
186 using ::testing::_;
187
188 namespace compiz
189@@ -103,6 +104,7 @@
190 ValueGenerator valueGenerator;
191 Expectation expectation;
192 CCSSettingType settingType;
193+ CCSSettingType returnType;
194 };
195
196 namespace impl
197@@ -114,10 +116,10 @@
198
199 ccit::GSettingsIntegratedSettingInfo settingsInfo[] =
200 {
201- { vg::i, cvg::integer, ex::integer, TypeInt },
202- { vg::b, cvg::boolean, ex::boolean, TypeBool },
203- { vg::s, cvg::string, ex::string, TypeString },
204- { vg::as, cvg::key, ex::key, TypeKey }
205+ { vg::i, cvg::integer, ex::integer, TypeInt, TypeInt },
206+ { vg::b, cvg::boolean, ex::boolean, TypeBool, TypeBool },
207+ { vg::s, cvg::string, ex::string, TypeString, TypeString },
208+ { vg::as, cvg::key, ex::key, TypeKey, TypeString }
209 };
210 }
211 }
212@@ -361,6 +363,7 @@
213 const CCSSettingType createSettingType =
214 std::tr1::get <0> (GetParam ());
215
216+ /* The GSettings Integrated setting takes ownership of these */
217 CCSIntegratedSettingInfo *integratedSetting = ccsSharedIntegratedSettingInfoNew (keyName.c_str (),
218 keyName.c_str (),
219 integratedSettingInfo.settingType,
220@@ -370,14 +373,15 @@
221 specialType,
222 keyName.c_str (),
223 &ccsDefaultObjectAllocator);
224- CCSIntegratedSetting *gsettingsIntegrated = ccsGSettingsIntegratedSettingNew (gnomeIntegratedSetting,
225- mWrapper.get (),
226- &ccsDefaultObjectAllocator);
227+ boost::shared_ptr <CCSIntegratedSetting> gsettingsIntegrated (AutoDestroy (ccsGSettingsIntegratedSettingNew (gnomeIntegratedSetting,
228+ mWrapper.get (),
229+ &ccsDefaultObjectAllocator),
230+ ccsIntegratedSettingUnref));
231
232 GVariant *variant = (*integratedSettingInfo.variantGenerator) ();
233 EXPECT_CALL (*mWrapperMock, getValue (Eq (keyName))).WillOnce (Return (variant));
234
235- CCSSettingValue *value = ccsIntegratedSettingReadValue (gsettingsIntegrated, createSettingType);
236+ CCSSettingValue *value = ccsIntegratedSettingReadValue (gsettingsIntegrated.get (), createSettingType);
237
238 if (createSettingType == integratedSettingInfo.settingType)
239 (*integratedSettingInfo.expectation) (value);
240@@ -385,7 +389,12 @@
241 EXPECT_THAT (value, IsNull ());
242
243 if (value)
244- ccsFreeSettingValueWithType (value, integratedSettingInfo.settingType);
245+ ccsFreeSettingValueWithType (value, integratedSettingInfo.returnType);
246+}
247+
248+ACTION (FreeVariant)
249+{
250+ g_variant_unref (arg0);
251 }
252
253 TEST_P (CCSGSettingsIntegratedSettingTest, MatchedTypesReturnValueMismatchedTypesResetOrWrite)
254@@ -405,14 +414,15 @@
255 specialType,
256 keyName.c_str (),
257 &ccsDefaultObjectAllocator);
258- CCSIntegratedSetting *gsettingsIntegrated = ccsGSettingsIntegratedSettingNew (gnomeIntegratedSetting,
259- mWrapper.get (),
260- &ccsDefaultObjectAllocator);
261+ boost::shared_ptr <CCSIntegratedSetting> gsettingsIntegrated (AutoDestroy (ccsGSettingsIntegratedSettingNew (gnomeIntegratedSetting,
262+ mWrapper.get (),
263+ &ccsDefaultObjectAllocator),
264+ ccsIntegratedSettingUnref));
265
266 boost::shared_ptr <CCSSettingValue> value ((*integratedSettingInfo.valueGenerator) (),
267 boost::bind (ccsFreeSettingValueWithType,
268 _1,
269- integratedSettingInfo.settingType));
270+ integratedSettingInfo.returnType));
271 boost::shared_ptr <GVariant> variant = AutoDestroy (g_variant_ref ((*integratedSettingInfo.variantGenerator) ()),
272 g_variant_unref);
273 boost::shared_ptr <GVariant> newVariant = AutoDestroy (ccvg::fromValue (value.get (),
274@@ -421,11 +431,12 @@
275 EXPECT_CALL (*mWrapperMock, getValue (Eq (keyName))).WillOnce (Return (variant.get ()));
276
277 if (createSettingType == integratedSettingInfo.settingType)
278- EXPECT_CALL (*mWrapperMock, setValue (Eq (keyName), VariantEqual (newVariant.get ())));
279+ EXPECT_CALL (*mWrapperMock, setValue (Eq (keyName), VariantEqual (newVariant.get ())))
280+ .WillOnce (WithArgs <1> (FreeVariant ()));
281 else
282 EXPECT_CALL (*mWrapperMock, resetKey (Eq (keyName)));
283
284- ccsIntegratedSettingWriteValue (gsettingsIntegrated, value.get (), createSettingType);
285+ ccsIntegratedSettingWriteValue (gsettingsIntegrated.get (), value.get (), createSettingType);
286 }
287
288 INSTANTIATE_TEST_CASE_P (CCSGSettingsIntegratedSettingTestMismatchedValues, CCSGSettingsIntegratedSettingTest,
289
290=== modified file 'compizconfig/libcompizconfig/src/bindings.c'
291--- compizconfig/libcompizconfig/src/bindings.c 2012-07-29 10:11:30 +0000
292+++ compizconfig/libcompizconfig/src/bindings.c 2012-09-25 08:46:22 +0000
293@@ -219,9 +219,9 @@
294
295 if (button->button)
296 {
297- char buttonStr[256];
298+ char buttonStr[256];
299 snprintf (buttonStr, 256, "Button%d", button->button);
300- binding = stringAppend (binding, buttonStr);
301+ binding = stringAppend (binding, buttonStr);
302 }
303
304 if (!binding)
305
306=== removed file 'compizconfig/tests/compizconfig_ccs_list_wrapper.h'
307--- compizconfig/tests/compizconfig_ccs_list_wrapper.h 2012-09-25 08:46:22 +0000
308+++ compizconfig/tests/compizconfig_ccs_list_wrapper.h 1970-01-01 00:00:00 +0000
309@@ -1,163 +0,0 @@
310-/*
311- * Compiz configuration system library
312- *
313- * Copyright (C) 2012 Canonical Ltd.
314- *
315- * This library is free software; you can redistribute it and/or
316- * modify it under the terms of the GNU Lesser General Public
317- * License as published by the Free Software Foundation; either
318- * version 2.1 of the License, or (at your option) any later version.
319-
320- * This library is distributed in the hope that it will be useful,
321- * but WITHOUT ANY WARRANTY; without even the implied warranty of
322- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
323- * Lesser General Public License for more details.
324-
325- * You should have received a copy of the GNU Lesser General Public
326- * License along with this library; if not, write to the Free Software
327- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
328- *
329- * Authored By:
330- * Sam Spilsbury <sam.spilsbury@canonical.com>
331- */
332-#ifndef _COMPIZCONFIG_CCS_LIST_WRAPPER_H
333-#define _COMPIZCONFIG_CCS_LIST_WRAPPER_H
334-
335-#include <ccs-defs.h>
336-#include <ccs-setting-types.h>
337-
338-#include <boost/shared_ptr.hpp>
339-#include <boost/noncopyable.hpp>
340-
341-typedef struct _CCSSettingValueList * CCSSettingValueList;
342-typedef struct _CCSSetting CCSSetting;
343-typedef union _CCSSettingInfo CCSSettingInfo;
344-typedef struct _CCSSettingValue CCSSettingValue;
345-
346-namespace compiz
347-{
348- namespace config
349- {
350- template <typename ListType, typename DataType>
351- class ListWrapper :
352- boost::noncopyable
353- {
354- public:
355-
356- virtual ~ListWrapper () {}
357-
358- virtual ListWrapper<ListType, DataType> & append (const DataType &) = 0;
359- virtual ListWrapper<ListType, DataType> & remove (const DataType &) = 0;
360-
361- virtual operator const ListType & () const = 0;
362- virtual operator ListType & () = 0;
363- };
364-
365- namespace impl
366- {
367- namespace cc = compiz::config;
368- namespace cci = compiz::config::impl;
369-
370- typedef enum _ListStorageType
371- {
372- Shallow = 0,
373- Deep = 1
374- } ListStorageType;
375-
376- template <typename ListType, typename DataType>
377- class ListWrapper :
378- public cc::ListWrapper <ListType, DataType>
379- {
380- public:
381-
382- typedef ListType (*ListTypeFreeFunc) (ListType, Bool);
383- typedef ListType (*ListTypeAppendFunc) (ListType, DataType);
384- typedef ListType (*ListTypeRemoveFunc) (ListType, DataType, Bool);
385-
386- ListWrapper (const ListType &list,
387- ListTypeFreeFunc freeFunc,
388- ListTypeAppendFunc appendFunc,
389- ListTypeRemoveFunc removeFunc,
390- ListStorageType storageType) :
391- mList (list),
392- mFree (freeFunc),
393- mAppend (appendFunc),
394- mRemove (removeFunc),
395- mStorageType (storageType)
396- {
397- };
398-
399- cc::ListWrapper<ListType, DataType> & append (DataType const &data)
400- {
401- mList = (*mAppend) (mList, data);
402- return *this;
403- }
404-
405- cc::ListWrapper<ListType, DataType> & remove (DataType const &data)
406- {
407- Bool freeObj = (mStorageType == Deep);
408- mList = (*mRemove) (mList, data, freeObj);
409- return *this;
410- }
411-
412- operator const ListType & () const
413- {
414- return mList;
415- }
416-
417- operator ListType & ()
418- {
419- return mList;
420- }
421-
422- ~ListWrapper ()
423- {
424- Bool freeObj = (mStorageType == Deep);
425-
426- (*mFree) (mList, freeObj);
427- }
428-
429- private:
430-
431- ListType mList;
432- ListTypeFreeFunc mFree;
433- ListTypeAppendFunc mAppend;
434- ListTypeRemoveFunc mRemove;
435- ListStorageType mStorageType;
436- };
437-
438- class PrivateSettingValueListWrapper;
439- class SettingValueListWrapper :
440- public compiz::config::ListWrapper <CCSSettingValueList, CCSSettingValue *>
441- {
442- public:
443-
444- typedef boost::shared_ptr <SettingValueListWrapper> Ptr;
445- typedef compiz::config::ListWrapper <CCSSettingValueList, CCSSettingValue *> InternalWrapper;
446- typedef compiz::config::impl::ListWrapper <CCSSettingValueList, CCSSettingValue *> InternalWrapperImpl;
447-
448- SettingValueListWrapper (CCSSettingValueList list,
449- ListStorageType storageType,
450- CCSSettingType type,
451- const boost::shared_ptr <CCSSettingInfo> &listInfo,
452- const boost::shared_ptr <CCSSetting> &settingReference);
453-
454- CCSSettingType type ();
455-
456- InternalWrapper & append (CCSSettingValue * const &value);
457- InternalWrapper & remove (CCSSettingValue * const &value);
458- operator const CCSSettingValueList & () const;
459- operator CCSSettingValueList & ();
460- const boost::shared_ptr <CCSSetting> & setting ();
461-
462- private:
463-
464- boost::shared_ptr <PrivateSettingValueListWrapper> priv;
465- };
466- }
467- }
468-}
469-
470-
471-
472-#endif

Subscribers

People subscribed via source and target branches