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
=== modified file 'extensions/history-list.vala'
--- extensions/history-list.vala 2013-06-07 09:46:39 +0000
+++ extensions/history-list.vala 2013-06-13 20:40:35 +0000
@@ -50,6 +50,8 @@
50 Gtk.TreeViewColumn? column;50 Gtk.TreeViewColumn? column;
5151
52 this.treeview.get_cursor (out path, out column);52 this.treeview.get_cursor (out path, out column);
53 if (path == null)
54 return;
5355
54 unowned int[] indices = path.get_indices ();56 unowned int[] indices = path.get_indices ();
55 int new_index = indices[0] + step;57 int new_index = indices[0] + step;
@@ -171,13 +173,16 @@
171 Gtk.TreeViewColumn? column;173 Gtk.TreeViewColumn? column;
172174
173 this.treeview.get_cursor (out path, out column);175 this.treeview.get_cursor (out path, out column);
176 if (path == null)
177 return;
174178
175 var model = this.treeview.get_model () as Gtk.ListStore;179 var model = this.treeview.get_model () as Gtk.ListStore;
176180
177 Gtk.TreeIter iter;181 Gtk.TreeIter iter;
178 unowned Midori.View? view = null;182 unowned Midori.View? view = null;
179183
180 model.get_iter (out iter, path);184 if (!model.get_iter (out iter, path))
185 return;
181 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);186 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);
182 this.browser.set ("tab", view);187 this.browser.set ("tab", view);
183 }188 }
@@ -212,6 +217,12 @@
212217
213 model.get_iter (out iter, path);218 model.get_iter (out iter, path);
214 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);219 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);
220#if !HAVE_GTK3
221 /* removing the selected cursor causes a segfault when using GTK2 */
222 if (path.prev () == false)
223 path.next ();
224 this.treeview.set_cursor (path, column, false);
225#endif
215226
216 /*227 /*
217 FixMe: the retrun value of `Gtk.ListStore.remove` should be checked228 FixMe: the retrun value of `Gtk.ListStore.remove` should be checked

Subscribers

People subscribed via source and target branches

to all changes: