Merge lp:~ivaldi/midori/fix-1190061 into lp:midori

Proposed by André Stösel
Status: Merged
Approved by: Cris Dywan
Approved revision: 6210
Merged at revision: 6209
Proposed branch: lp:~ivaldi/midori/fix-1190061
Merge into: lp:midori
Diff against target: 43 lines (+12/-1)
1 file modified
extensions/history-list.vala (+12/-1)
To merge this branch: bzr merge lp:~ivaldi/midori/fix-1190061
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Paweł Forysiuk Approve
Review via email: mp+168872@code.launchpad.net

Commit message

Fix segfault when deleteing tabs with history list

To post a comment you must log in.
Revision history for this message
Paweł Forysiuk (tuxator) wrote :

It no longer crashes for me. Even with multiple deletions.

review: Approve
Revision history for this message
Cris Dywan (kalikiana) wrote :

I'd like clarification on the #if. What do we lose with GTK+2 here? And do we know why it crashed, is it a GTK+2 bug?

review: Needs Fixing
Revision history for this message
André Stösel (ivaldi) wrote :

Dunno if it's a GTK2 bug, but if you remove the selected item it segfaults. The easiest solution is to change the selection before removing the item.

lp:~ivaldi/midori/fix-1190061 updated
6210. By André Stösel

add a note for clarification

Revision history for this message
André Stösel (ivaldi) wrote :

I added a note for clarification.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Thanks a lot!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'extensions/history-list.vala'
2--- extensions/history-list.vala 2013-06-07 09:46:39 +0000
3+++ extensions/history-list.vala 2013-06-13 20:40:35 +0000
4@@ -50,6 +50,8 @@
5 Gtk.TreeViewColumn? column;
6
7 this.treeview.get_cursor (out path, out column);
8+ if (path == null)
9+ return;
10
11 unowned int[] indices = path.get_indices ();
12 int new_index = indices[0] + step;
13@@ -171,13 +173,16 @@
14 Gtk.TreeViewColumn? column;
15
16 this.treeview.get_cursor (out path, out column);
17+ if (path == null)
18+ return;
19
20 var model = this.treeview.get_model () as Gtk.ListStore;
21
22 Gtk.TreeIter iter;
23 unowned Midori.View? view = null;
24
25- model.get_iter (out iter, path);
26+ if (!model.get_iter (out iter, path))
27+ return;
28 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);
29 this.browser.set ("tab", view);
30 }
31@@ -212,6 +217,12 @@
32
33 model.get_iter (out iter, path);
34 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);
35+#if !HAVE_GTK3
36+ /* removing the selected cursor causes a segfault when using GTK2 */
37+ if (path.prev () == false)
38+ path.next ();
39+ this.treeview.set_cursor (path, column, false);
40+#endif
41
42 /*
43 FixMe: the retrun value of `Gtk.ListStore.remove` should be checked

Subscribers

People subscribed via source and target branches

to all changes: