Merge lp:~gue5t/midori/bitesize-leaks into lp:midori

Proposed by gue5t gue5t
Status: Merged
Approved by: gue5t gue5t
Approved revision: 6674
Merged at revision: 6682
Proposed branch: lp:~gue5t/midori/bitesize-leaks
Merge into: lp:midori
Diff against target: 36 lines (+4/-0)
3 files modified
midori/main.c (+1/-0)
midori/midori-browser.c (+1/-0)
midori/midori-frontend.c (+2/-0)
To merge this branch: bzr merge lp:~gue5t/midori/bitesize-leaks
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Review via email: mp+216813@code.launchpad.net

Commit message

Fix a few simple leaks

Description of the change

Fix a few simple leaks. The first is the MidoriApp singleton, whose ownership is never given to a container, but which is also never unreffed after the main loop ends. We should create the app, run our main loop, and then unref the app.

The second is that while a browser unsets its bookmarks when disposing, it doesn't unset its history. History holds a reference on the MidoriApp via midori_history_set_app, so it's important to make sure history is cleaned up properly.

The third is that the MidoriApp is set as the parent of the KatzeArray used to store the session to be restored. This feature doesn't work right now with tabby, and nothing ever stores this session anyhow, so it's safe to unset the parent and unref the array after the last time it's used, to avoid leaking it and its reference to the MidoriApp.

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

Those looks sane… do you by any chance have ideas on how to verify that these stay fixed? Say a ref count check in a test case before and after doing something.

I'll approve and leave it up to you whether to merge now or if you have some ideas.

review: Approve
Revision history for this message
gue5t gue5t (gue5t) wrote :

I'll merge now I guess, as I'm going to have some more refcounting patches which will be another opportunity to introduce some refcounting/leak tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/main.c'
2--- midori/main.c 2013-10-30 00:05:40 +0000
3+++ midori/main.c 2014-04-23 03:44:51 +0000
4@@ -391,6 +391,7 @@
5 g_signal_connect (app, "quit", G_CALLBACK (gtk_main_quit), NULL);
6 gtk_main ();
7 midori_normal_app_on_quit (app);
8+ g_object_unref (app);
9 return 0;
10 }
11
12
13=== modified file 'midori/midori-browser.c'
14--- midori/midori-browser.c 2014-04-16 21:00:49 +0000
15+++ midori/midori-browser.c 2014-04-23 03:44:51 +0000
16@@ -6187,6 +6187,7 @@
17 midori_browser_settings_notify,
18 browser);
19 midori_browser_set_bookmarks (browser, NULL);
20+ midori_browser_set_history (browser, NULL);
21
22 G_OBJECT_CLASS (midori_browser_parent_class)->dispose (object);
23 }
24
25=== modified file 'midori/midori-frontend.c'
26--- midori/midori-frontend.c 2014-04-06 16:31:06 +0000
27+++ midori/midori-frontend.c 2014-04-23 03:44:51 +0000
28@@ -585,6 +585,8 @@
29 return NULL;
30 load_on_startup = response;
31 }
32+ katze_item_set_parent (KATZE_ITEM (session), NULL);
33+ g_object_unref (session);
34 g_object_set_data (G_OBJECT (settings), "load-on-startup", GINT_TO_POINTER (load_on_startup));
35
36 g_object_set (app, "settings", settings,

Subscribers

People subscribed via source and target branches

to all changes: