Merge lp:~gue5t/midori/resource-ref into lp:midori

Proposed by gue5t gue5t
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6742
Merged at revision: 6767
Proposed branch: lp:~gue5t/midori/resource-ref
Merge into: lp:midori
Diff against target: 49 lines (+13/-1)
2 files modified
midori/midori-browser.c (+1/-0)
midori/midori-view.c (+12/-1)
To merge this branch: bzr merge lp:~gue5t/midori/resource-ref
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+228922@code.launchpad.net

Commit message

Fix crash when saving with associated resources

Description of the change

This fixes a crash caused by not reffing resources which we obtain from WebKit when saving them.

To post a comment you must log in.
lp:~gue5t/midori/resource-ref updated
6742. By gue5t <email address hidden>

Merge upstream

Revision history for this message
Paweł Forysiuk (tuxator) wrote :

Looks sensible and fixed the crash.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-browser.c'
2--- midori/midori-browser.c 2014-07-27 16:50:30 +0000
3+++ midori/midori-browser.c 2014-07-30 17:48:41 +0000
4@@ -1372,6 +1372,7 @@
5 katze_assign (last_dir,
6 gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
7 }
8+ g_list_foreach (resources, (GFunc)g_object_unref, NULL);
9 g_list_free (resources);
10 #else
11 filename = midori_download_clean_filename (title);
12
13=== modified file 'midori/midori-view.c'
14--- midori/midori-view.c 2014-07-27 16:50:30 +0000
15+++ midori/midori-view.c 2014-07-30 17:48:41 +0000
16@@ -2037,6 +2037,14 @@
17 g_free (uri);
18 }
19
20+/**
21+ * midori_view_get_resources:
22+ * @view: a #MidoriView
23+ *
24+ * Obtain a list of the resources loaded by the page shown in the view.
25+ *
26+ * Return value: (transfer full) (element-type WebKitWebResource): the resources
27+ **/
28 GList*
29 midori_view_get_resources (MidoriView* view)
30 {
31@@ -2047,7 +2055,9 @@
32 WebKitWebFrame* frame = webkit_web_view_get_main_frame (web_view);
33 WebKitWebDataSource* data_source = webkit_web_frame_get_data_source (frame);
34 GList* resources = webkit_web_data_source_get_subresources (data_source);
35- return g_list_prepend (resources, webkit_web_data_source_get_main_resource (data_source));
36+ resources = g_list_prepend (resources, webkit_web_data_source_get_main_resource (data_source));
37+ g_list_foreach (resources, (GFunc)g_object_ref, NULL);
38+ return resources;
39 #else
40 return NULL;
41 #endif
42@@ -2073,6 +2083,7 @@
43 }
44 }
45 #endif
46+ g_list_foreach (resources, (GFunc)g_object_unref, NULL);
47 g_list_free (resources);
48 return result;
49 }

Subscribers

People subscribed via source and target branches

to all changes: