Merge lp:~gero-bare/scratch/fix-1472377 into lp:~elementary-apps/scratch/scratch

Proposed by Gero.Bare
Status: Merged
Approved by: The Lemon Man
Approved revision: 1591
Merged at revision: 1589
Proposed branch: lp:~gero-bare/scratch/fix-1472377
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 20 lines (+8/-2)
1 file modified
src/Widgets/DocumentView.vala (+8/-2)
To merge this branch: bzr merge lp:~gero-bare/scratch/fix-1472377
Reviewer Review Type Date Requested Status
The Lemon Man (community) code Approve
Review via email: mp+277059@code.launchpad.net

This proposal supersedes a proposal from 2015-11-09.

Commit message

Move tab to new window from main loop

Description of the change

Move tab to new window from main loop (lp:1472377)

To post a comment you must log in.
Revision history for this message
The Lemon Man (lemonboy) wrote : Posted in a previous version of this proposal

Code-wise LGTM, I'd just add a short comment explaining why it's being done in the main thread.

review: Approve (code)
Revision history for this message
The Lemon Man (lemonboy) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/DocumentView.vala'
2--- src/Widgets/DocumentView.vala 2015-10-29 23:03:09 +0000
3+++ src/Widgets/DocumentView.vala 2015-11-09 21:27:51 +0000
4@@ -249,8 +249,14 @@
5
6 DocumentView other_view = other_window.add_view ();
7
8- this.notebook.remove_tab (doc);
9- other_view.notebook.insert_tab (doc, -1);
10+ // We need to make sure switch back to the main thread
11+ // when we are modifiying Gtk widgets shared by two threads.
12+ Idle.add (() => {
13+ this.notebook.remove_tab (doc);
14+ other_view.notebook.insert_tab (doc, -1);
15+
16+ return false;
17+ });
18 }
19
20 private void on_doc_reordered (Granite.Widgets.Tab tab, int new_pos) {

Subscribers

People subscribed via source and target branches