Merge lp:~charlesk/ubuntu-app-launch/fix-launch-leak-and-minor-warnings into lp:ubuntu-app-launch/16.10

Proposed by Charles Kerr
Status: Superseded
Proposed branch: lp:~charlesk/ubuntu-app-launch/fix-launch-leak-and-minor-warnings
Merge into: lp:ubuntu-app-launch/16.10
Diff against target: 471 lines (+86/-82)
25 files modified
libubuntu-app-launch/CMakeLists.txt (+1/-1)
libubuntu-app-launch/app-info.c (+1/-1)
libubuntu-app-launch/appid.h (+4/-4)
libubuntu-app-launch/application-impl-base.cpp (+3/-3)
libubuntu-app-launch/application-impl-base.h (+3/-3)
libubuntu-app-launch/application-impl-click.cpp (+4/-4)
libubuntu-app-launch/application-impl-click.h (+3/-3)
libubuntu-app-launch/application-impl-legacy.cpp (+3/-3)
libubuntu-app-launch/application-impl-legacy.h (+4/-4)
libubuntu-app-launch/application-impl-libertine.cpp (+3/-3)
libubuntu-app-launch/application-impl-libertine.h (+4/-4)
libubuntu-app-launch/application-info-desktop.cpp (+12/-15)
libubuntu-app-launch/application-info-desktop.h (+3/-3)
libubuntu-app-launch/application.cpp (+2/-2)
libubuntu-app-launch/application.h (+8/-2)
libubuntu-app-launch/helper-impl-click.cpp (+6/-5)
libubuntu-app-launch/helper-impl-click.h (+3/-3)
libubuntu-app-launch/helper.cpp (+2/-2)
libubuntu-app-launch/helper.h (+2/-2)
libubuntu-app-launch/registry-impl.cpp (+2/-2)
libubuntu-app-launch/registry-impl.h (+2/-2)
libubuntu-app-launch/registry.cpp (+2/-2)
libubuntu-app-launch/registry.h (+5/-5)
libubuntu-app-launch/type-tagger.h (+2/-2)
libubuntu-app-launch/ubuntu-app-launch.h (+2/-2)
To merge this branch: bzr merge lp:~charlesk/ubuntu-app-launch/fix-launch-leak-and-minor-warnings
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Pending
Ted Gould Pending
Review via email: mp+296832@code.launchpad.net

This proposal has been superseded by a proposal from 2016-06-09.

Commit message

Fix memory leak in Click::launch()

Description of the change

Fix a couple of minor warnings seen while using libual in Keeper:

* Fix a string memory leak in Click::launch()
* Application, Application::Info, and Application::Instance() need virtual dtors because they have virtual methods
* (trivial) Remove trailing commas from enum lists
* (trivial) Remove trailing semicolons from namespaces

To post a comment you must log in.
236. By Charles Kerr

merge lp:~ted/ubuntu-app-launch/pedantic-no-oom

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntu-app-launch/CMakeLists.txt'
2--- libubuntu-app-launch/CMakeLists.txt 2016-05-02 13:47:11 +0000
3+++ libubuntu-app-launch/CMakeLists.txt 2016-06-09 15:02:29 +0000
4@@ -16,7 +16,7 @@
5 add_lttng_gen_tp(NAME ubuntu-app-launch-trace)
6
7 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
8-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
9+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wpedantic")
10 add_definitions ( -DOOM_HELPER="${pkglibexecdir}/oom-adjust-setuid-helper" -DDEMANGLER_PATH="${pkglibexecdir}/socket-demangler" )
11 add_definitions ( -DLIBERTINE_LAUNCH="${CMAKE_INSTALL_FULL_BINDIR}/libertine-launch" )
12
13
14=== modified file 'libubuntu-app-launch/app-info.c'
15--- libubuntu-app-launch/app-info.c 2015-08-12 02:52:05 +0000
16+++ libubuntu-app-launch/app-info.c 2016-06-09 15:02:29 +0000
17@@ -77,12 +77,12 @@
18 }
19
20 /* Types of search we can do for an app name */
21-typedef enum _app_name_t app_name_t;
22 enum _app_name_t {
23 APP_NAME_ONLY,
24 APP_NAME_FIRST,
25 APP_NAME_LAST
26 };
27+typedef enum _app_name_t app_name_t;
28
29 /* Figure out the app name if it's one of the keywords */
30 static const gchar *
31
32=== modified file 'libubuntu-app-launch/appid.h'
33--- libubuntu-app-launch/appid.h 2016-04-18 18:29:32 +0000
34+++ libubuntu-app-launch/appid.h 2016-06-09 15:02:29 +0000
35@@ -119,12 +119,12 @@
36 {
37 FIRST_LISTED, /**< First application listed in the manifest */
38 LAST_LISTED, /**< Last application listed in the manifest */
39- ONLY_LISTED, /**< Only application listed in the manifest */
40+ ONLY_LISTED /**< Only application listed in the manifest */
41 };
42 /** Control how the versions are searched in the discover() set of functions */
43 enum class VersionWildcard
44 {
45- CURRENT_USER_VERSION, /**< The current installed version */
46+ CURRENT_USER_VERSION /**< The current installed version */
47 };
48
49 /** Find the AppID for an application where you only know the package
50@@ -159,7 +159,7 @@
51 bool operator==(const AppID& a, const AppID& b);
52 bool operator!=(const AppID& a, const AppID& b);
53
54-}; // namespace app_launch
55-}; // namespace ubuntu
56+} // namespace app_launch
57+} // namespace ubuntu
58
59 #pragma GCC visibility pop
60
61=== modified file 'libubuntu-app-launch/application-impl-base.cpp'
62--- libubuntu-app-launch/application-impl-base.cpp 2016-02-09 22:12:32 +0000
63+++ libubuntu-app-launch/application-impl-base.cpp 2016-06-09 15:02:29 +0000
64@@ -157,6 +157,6 @@
65 return std::make_shared<BaseInstance>(appIdStr);
66 }
67
68-}; // namespace app_impls
69-}; // namespace app_launch
70-}; // namespace ubuntu
71+} // namespace app_impls
72+} // namespace app_launch
73+} // namespace ubuntu
74
75=== modified file 'libubuntu-app-launch/application-impl-base.h'
76--- libubuntu-app-launch/application-impl-base.h 2016-02-09 22:12:32 +0000
77+++ libubuntu-app-launch/application-impl-base.h 2016-06-09 15:02:29 +0000
78@@ -47,6 +47,6 @@
79 std::shared_ptr<Registry> _registry;
80 };
81
82-}; // namespace app_impls
83-}; // namespace app_launch
84-}; // namespace ubuntu
85+} // namespace app_impls
86+} // namespace app_launch
87+} // namespace ubuntu
88
89=== modified file 'libubuntu-app-launch/application-impl-click.cpp'
90--- libubuntu-app-launch/application-impl-click.cpp 2016-03-03 20:48:24 +0000
91+++ libubuntu-app-launch/application-impl-click.cpp 2016-06-09 15:02:29 +0000
92@@ -143,7 +143,7 @@
93
94 for (auto appname : manifestApps(manifest))
95 {
96- AppID appid{package : pkg, appname : appname, version : manifestVersion(manifest)};
97+ AppID appid{pkg, appname, manifestVersion(manifest)};
98 auto app = std::make_shared<Click>(appid, manifest, registry);
99 applist.push_back(app);
100 }
101@@ -152,6 +152,6 @@
102 return applist;
103 }
104
105-}; // namespace app_impls
106-}; // namespace app_launch
107-}; // namespace ubuntu
108+} // namespace app_impls
109+} // namespace app_launch
110+} // namespace ubuntu
111
112=== modified file 'libubuntu-app-launch/application-impl-click.h'
113--- libubuntu-app-launch/application-impl-click.h 2016-02-10 15:08:26 +0000
114+++ libubuntu-app-launch/application-impl-click.h 2016-06-09 15:02:29 +0000
115@@ -51,6 +51,6 @@
116 std::shared_ptr<GKeyFile> _keyfile;
117 };
118
119-}; // namespace app_impls
120-}; // namespace app_launch
121-}; // namespace ubuntu
122+} // namespace app_impls
123+} // namespace app_launch
124+} // namespace ubuntu
125
126=== modified file 'libubuntu-app-launch/application-impl-legacy.cpp'
127--- libubuntu-app-launch/application-impl-legacy.cpp 2016-05-02 13:59:09 +0000
128+++ libubuntu-app-launch/application-impl-legacy.cpp 2016-06-09 15:02:29 +0000
129@@ -132,6 +132,6 @@
130 return list;
131 }
132
133-}; // namespace app_impls
134-}; // namespace app_launch
135-}; // namespace ubuntu
136+} // namespace app_impls
137+} // namespace app_launch
138+} // namespace ubuntu
139
140=== modified file 'libubuntu-app-launch/application-impl-legacy.h'
141--- libubuntu-app-launch/application-impl-legacy.h 2016-05-02 13:47:11 +0000
142+++ libubuntu-app-launch/application-impl-legacy.h 2016-06-09 15:02:29 +0000
143@@ -41,7 +41,7 @@
144
145 AppID appId() override
146 {
147- return {package : AppID::Package::from_raw({}), appname : _appname, version : AppID::Version::from_raw({})};
148+ return {AppID::Package::from_raw({}), _appname, AppID::Version::from_raw({})};
149 }
150
151 std::shared_ptr<Info> info() override;
152@@ -54,6 +54,6 @@
153 std::shared_ptr<GKeyFile> _keyfile;
154 };
155
156-}; // namespace app_impls
157-}; // namespace app_launch
158-}; // namespace ubuntu
159+} // namespace app_impls
160+} // namespace app_launch
161+} // namespace ubuntu
162
163=== modified file 'libubuntu-app-launch/application-impl-libertine.cpp'
164--- libubuntu-app-launch/application-impl-libertine.cpp 2016-05-02 15:16:29 +0000
165+++ libubuntu-app-launch/application-impl-libertine.cpp 2016-06-09 15:02:29 +0000
166@@ -136,6 +136,6 @@
167 return std::make_shared<app_info::Desktop>(_keyfile, _basedir, _registry);
168 }
169
170-}; // namespace app_impls
171-}; // namespace app_launch
172-}; // namespace ubuntu
173+} // namespace app_impls
174+} // namespace app_launch
175+} // namespace ubuntu
176
177=== modified file 'libubuntu-app-launch/application-impl-libertine.h'
178--- libubuntu-app-launch/application-impl-libertine.h 2016-05-02 13:26:24 +0000
179+++ libubuntu-app-launch/application-impl-libertine.h 2016-06-09 15:02:29 +0000
180@@ -40,7 +40,7 @@
181
182 AppID appId() override
183 {
184- return {package : _container, appname : _appname, version : AppID::Version::from_raw("0.0")};
185+ return {_container, _appname, AppID::Version::from_raw("0.0")};
186 }
187
188 std::shared_ptr<Info> info() override;
189@@ -52,6 +52,6 @@
190 std::string _basedir;
191 };
192
193-}; // namespace app_impls
194-}; // namespace app_launch
195-}; // namespace ubuntu
196+} // namespace app_impls
197+} // namespace app_launch
198+} // namespace ubuntu
199
200=== modified file 'libubuntu-app-launch/application-info-desktop.cpp'
201--- libubuntu-app-launch/application-info-desktop.cpp 2016-05-10 19:09:34 +0000
202+++ libubuntu-app-launch/application-info-desktop.cpp 2016-06-09 15:02:29 +0000
203@@ -201,17 +201,15 @@
204 }
205 return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, "Icon", "Missing icon for desktop file");
206 }())
207- , _splashInfo({
208- title : stringFromKeyfile<Application::Info::Splash::Title>(keyfile, "X-Ubuntu-Splash-Title"),
209- image : fileFromKeyfile<Application::Info::Splash::Image>(keyfile, basePath, "X-Ubuntu-Splash-Image"),
210- backgroundColor : stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color"),
211- headerColor : stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color-Header"),
212- footerColor : stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color-Footer"),
213- showHeader :
214- boolFromKeyfile<Application::Info::Splash::ShowHeader>(keyfile, "X-Ubuntu-Splash-Show-Header", false)
215- })
216+ , _splashInfo(
217+ {stringFromKeyfile<Application::Info::Splash::Title>(keyfile, "X-Ubuntu-Splash-Title"),
218+ fileFromKeyfile<Application::Info::Splash::Image>(keyfile, basePath, "X-Ubuntu-Splash-Image"),
219+ stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color"),
220+ stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color-Header"),
221+ stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color-Footer"),
222+ boolFromKeyfile<Application::Info::Splash::ShowHeader>(keyfile, "X-Ubuntu-Splash-Show-Header", false)})
223 , _supportedOrientations([keyfile]() {
224- Orientations all = {portrait : true, landscape : true, invertedPortrait : true, invertedLandscape : true};
225+ Orientations all = {true, true, true, true};
226
227 GError* error = nullptr;
228 auto orientationStrv = g_key_file_get_string_list(keyfile.get(), DESKTOP_GROUP,
229@@ -223,8 +221,7 @@
230 return all;
231 }
232
233- Orientations retval =
234- {portrait : false, landscape : false, invertedPortrait : false, invertedLandscape : false};
235+ Orientations retval = {false, false, false, false};
236
237 try
238 {
239@@ -272,6 +269,6 @@
240 {
241 }
242
243-}; // namespace app_info
244-}; // namespace app_launch
245-}; // namespace ubuntu
246+} // namespace app_info
247+} // namespace app_launch
248+} // namespace ubuntu
249
250=== modified file 'libubuntu-app-launch/application-info-desktop.h'
251--- libubuntu-app-launch/application-info-desktop.h 2016-04-29 18:51:31 +0000
252+++ libubuntu-app-launch/application-info-desktop.h 2016-06-09 15:02:29 +0000
253@@ -85,6 +85,6 @@
254 Application::Info::UbuntuLifecycle _ubuntuLifecycle;
255 };
256
257-}; // namespace AppInfo
258-}; // namespace AppLaunch
259-}; // namespace Ubuntu
260+} // namespace AppInfo
261+} // namespace AppLaunch
262+} // namespace Ubuntu
263
264=== modified file 'libubuntu-app-launch/application.cpp'
265--- libubuntu-app-launch/application.cpp 2016-05-02 20:06:22 +0000
266+++ libubuntu-app-launch/application.cpp 2016-06-09 15:02:29 +0000
267@@ -219,5 +219,5 @@
268 return appid;
269 }
270
271-}; // namespace app_launch
272-}; // namespace ubuntu
273+} // namespace app_launch
274+} // namespace ubuntu
275
276=== modified file 'libubuntu-app-launch/application.h'
277--- libubuntu-app-launch/application.h 2016-04-29 14:20:11 +0000
278+++ libubuntu-app-launch/application.h 2016-06-09 15:02:29 +0000
279@@ -61,6 +61,8 @@
280 */
281 static std::shared_ptr<Application> create(const AppID& appid, const std::shared_ptr<Registry>& registry);
282
283+ virtual ~Application() = default;
284+
285 /* System level info */
286 /** Get the Application ID of this Application */
287 virtual AppID appId() = 0;
288@@ -91,6 +93,8 @@
289 /** \private */
290 typedef TypeTagger<IconPathTag, std::string> IconPath;
291
292+ virtual ~Info() = default;
293+
294 /** Name of the application */
295 virtual const Name& name() = 0;
296 /** Textual description of the application */
297@@ -188,6 +192,8 @@
298 class Instance
299 {
300 public:
301+ virtual ~Instance() = default;
302+
303 /* Query lifecycle */
304 /** Check to see if the instance is currently running. The object can
305 exist even after the instance has stopped running. */
306@@ -238,7 +244,7 @@
307 virtual std::shared_ptr<Instance> launchTest(const std::vector<URL>& urls = {}) = 0;
308 };
309
310-}; // namespace app_launch
311-}; // namespace ubuntu
312+} // namespace app_launch
313+} // namespace ubuntu
314
315 #pragma GCC visibility pop
316
317=== modified file 'libubuntu-app-launch/helper-impl-click.cpp'
318--- libubuntu-app-launch/helper-impl-click.cpp 2016-03-03 20:48:24 +0000
319+++ libubuntu-app-launch/helper-impl-click.cpp 2016-06-09 15:02:29 +0000
320@@ -135,8 +135,9 @@
321 return _registry->impl->thread.executeOnThread<std::shared_ptr<Click::Instance>>([this, urlstrv]() {
322 auto instanceid = ubuntu_app_launch_start_multiple_helper(_type.value().c_str(), ((std::string)_appid).c_str(),
323 urlstrv.get());
324-
325- return std::make_shared<ClickInstance>(_appid, _type, instanceid, _registry);
326+ auto ret = std::make_shared<ClickInstance>(_appid, _type, instanceid, _registry);
327+ g_free(instanceid);
328+ return ret;
329 });
330 }
331
332@@ -170,6 +171,6 @@
333 });
334 }
335
336-}; // namespace helper_impl
337-}; // namespace app_launch
338-}; // namespace ubuntu
339+} // namespace helper_impl
340+} // namespace app_launch
341+} // namespace ubuntu
342
343=== modified file 'libubuntu-app-launch/helper-impl-click.h'
344--- libubuntu-app-launch/helper-impl-click.h 2016-02-09 21:55:05 +0000
345+++ libubuntu-app-launch/helper-impl-click.h 2016-06-09 15:02:29 +0000
346@@ -57,6 +57,6 @@
347 std::shared_ptr<Registry> _registry;
348 };
349
350-}; // namespace helper_impl
351-}; // namespace app_launch
352-}; // namespace ubuntu
353+} // namespace helper_impl
354+} // namespace app_launch
355+} // namespace ubuntu
356
357=== modified file 'libubuntu-app-launch/helper.cpp'
358--- libubuntu-app-launch/helper.cpp 2016-02-09 21:12:54 +0000
359+++ libubuntu-app-launch/helper.cpp 2016-06-09 15:02:29 +0000
360@@ -32,5 +32,5 @@
361 return std::make_shared<helper_impls::Click>(type, appid, registry);
362 }
363
364-}; // namespace AppLaunch
365-}; // namespace Ubuntu
366+} // namespace AppLaunch
367+} // namespace Ubuntu
368
369=== modified file 'libubuntu-app-launch/helper.h'
370--- libubuntu-app-launch/helper.h 2016-04-19 04:01:44 +0000
371+++ libubuntu-app-launch/helper.h 2016-06-09 15:02:29 +0000
372@@ -116,7 +116,7 @@
373 virtual std::shared_ptr<Instance> launch(MirPromptSession* session, std::vector<URL> urls = {}) = 0;
374 };
375
376-}; // namespace app_launch
377-}; // namespace ubuntu
378+} // namespace app_launch
379+} // namespace ubuntu
380
381 #pragma GCC visibility pop
382
383=== modified file 'libubuntu-app-launch/registry-impl.cpp'
384--- libubuntu-app-launch/registry-impl.cpp 2016-05-04 20:12:45 +0000
385+++ libubuntu-app-launch/registry-impl.cpp 2016-06-09 15:02:29 +0000
386@@ -193,5 +193,5 @@
387 }
388 #endif
389
390-}; // namespace app_launch
391-}; // namespace ubuntu
392+} // namespace app_launch
393+} // namespace ubuntu
394
395=== modified file 'libubuntu-app-launch/registry-impl.h'
396--- libubuntu-app-launch/registry-impl.h 2016-04-29 13:41:21 +0000
397+++ libubuntu-app-launch/registry-impl.h 2016-06-09 15:02:29 +0000
398@@ -75,5 +75,5 @@
399 std::unordered_map<std::string, std::shared_ptr<IconFinder>> _iconFinders;
400 };
401
402-}; // namespace app_launch
403-}; // namespace ubuntu
404+} // namespace app_launch
405+} // namespace ubuntu
406
407=== modified file 'libubuntu-app-launch/registry.cpp'
408--- libubuntu-app-launch/registry.cpp 2016-03-03 20:48:24 +0000
409+++ libubuntu-app-launch/registry.cpp 2016-06-09 15:02:29 +0000
410@@ -95,5 +95,5 @@
411 return defaultRegistry;
412 }
413
414-}; // namespace app_launch
415-}; // namespace ubuntu
416+} // namespace app_launch
417+} // namespace ubuntu
418
419=== modified file 'libubuntu-app-launch/registry.h'
420--- libubuntu-app-launch/registry.h 2016-04-19 02:59:45 +0000
421+++ libubuntu-app-launch/registry.h 2016-06-09 15:02:29 +0000
422@@ -49,9 +49,9 @@
423 failed. */
424 enum class FailureType
425 {
426- CRASH, /**< The application was running, but failed while running. */
427- START_FAILURE, /**< Something in the configuration of the application made it impossible to start the
428- application */
429+ CRASH, /**< The application was running, but failed while running. */
430+ START_FAILURE /**< Something in the configuration of the application made it impossible to start the
431+ application */
432 };
433
434 Registry();
435@@ -122,7 +122,7 @@
436 std::unique_ptr<Impl> impl;
437 };
438
439-}; // namespace app_launch
440-}; // namespace ubuntu
441+} // namespace app_launch
442+} // namespace ubuntu
443
444 #pragma GCC visibility pop
445
446=== modified file 'libubuntu-app-launch/type-tagger.h'
447--- libubuntu-app-launch/type-tagger.h 2016-04-18 18:29:32 +0000
448+++ libubuntu-app-launch/type-tagger.h 2016-06-09 15:02:29 +0000
449@@ -45,5 +45,5 @@
450 T _value; /**< The memory allocation for the fundamental type */
451 };
452
453-}; // namespace app_launch
454-}; // namespace ubuntu
455+} // namespace app_launch
456+} // namespace ubuntu
457
458=== modified file 'libubuntu-app-launch/ubuntu-app-launch.h'
459--- libubuntu-app-launch/ubuntu-app-launch.h 2016-04-21 19:47:10 +0000
460+++ libubuntu-app-launch/ubuntu-app-launch.h 2016-06-09 15:02:29 +0000
461@@ -35,8 +35,8 @@
462 * Types of failure that we report.
463 */
464 typedef enum { /*< prefix=UBUNTU_APP_LAUNCH_APP_FAILED */
465- UBUNTU_APP_LAUNCH_APP_FAILED_CRASH, /*< nick=crash */
466- UBUNTU_APP_LAUNCH_APP_FAILED_START_FAILURE, /*< nick=start-failure */
467+ UBUNTU_APP_LAUNCH_APP_FAILED_CRASH, /*< nick=crash */
468+ UBUNTU_APP_LAUNCH_APP_FAILED_START_FAILURE /*< nick=start-failure */
469 } UbuntuAppLaunchAppFailed;
470
471 /**

Subscribers

People subscribed via source and target branches