[gnome-boxes] Fix warning about relayout in allocation cycle



commit 98dbdfb30918c7174486d9e56e0f01c435420e01
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Aug 24 16:42:22 2012 +0200

    Fix warning about relayout in allocation cycle
    
    We can't relayout directly inside a size_allocate, instead we
    delay it with an idle.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682613

 src/machine.vala |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index 2f8e99f..c887543 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -499,7 +499,14 @@ private class Boxes.MachineActor: Boxes.UI {
 
             if (track_screenshot_id != 0)
                 App.app.properties.screenshot_placeholder.disconnect (track_screenshot_id);
-            track_screenshot_id = App.app.properties.screenshot_placeholder.size_allocate.connect (() => { update_screenshot_alloc (display); });
+            track_screenshot_id = App.app.properties.screenshot_placeholder.size_allocate.connect (() => {
+                // We need to update in an idle to avoid changing layout stuff in a layout cycle
+                // (i.e. inside the size_allocate)
+                Idle.add_full (Priority.HIGH, () => {
+                    update_screenshot_alloc (display);
+                    return false;
+                });
+            });
 
             if (!zoom) {
                 display.set_easing_duration (0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]