Merge lp:~veebers/checkbox/remove_conditional_memory_leak into lp:checkbox

Proposed by Christopher Lee
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 3922
Merged at revision: 3924
Proposed branch: lp:~veebers/checkbox/remove_conditional_memory_leak
Merge into: lp:checkbox
Diff against target: 14 lines (+2/-1)
1 file modified
checkbox-gui/checkbox-gui/main.cpp (+2/-1)
To merge this branch: bzr merge lp:~veebers/checkbox/remove_conditional_memory_leak
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+266345@code.launchpad.net

Commit message

Assign to settings once to avoid conditional memory leak

Description of the change

Assigning to 'Settings* settings' then conditionally re-assigning results in leaked memory. (Unless there is some Qt memory management magic happening here that I've missed).

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

That's indeed a much clever way. thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-gui/checkbox-gui/main.cpp'
2--- checkbox-gui/checkbox-gui/main.cpp 2014-04-01 23:23:44 +0000
3+++ checkbox-gui/checkbox-gui/main.cpp 2015-07-30 03:07:36 +0000
4@@ -63,9 +63,10 @@
5 guiengine.Initialise();
6
7 Settings* settings;
8- settings = new Settings();
9 if (app.arguments().size() > 1) {
10 settings = new Settings(app.arguments().at(1));
11+ } else {
12+ settings = new Settings();
13 }
14 viewer.rootContext()->setContextProperty("settings", settings);
15

Subscribers

People subscribed via source and target branches