[aseprite] 134/250: Create NSWindow in main thread/queue on Skia/OSX port

Tobias Hansen thansen at moszumanska.debian.org
Sun Dec 20 15:27:21 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 7118251f83338a195922dc70ae1891e29793b386
Author: David Capello <davidcapello at gmail.com>
Date:   Tue Oct 6 10:57:56 2015 -0300

    Create NSWindow in main thread/queue on Skia/OSX port
    
    We cannot create/handle UI controls outside the main thread.
---
 src/she/skia/skia_window_osx.mm | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/she/skia/skia_window_osx.mm b/src/she/skia/skia_window_osx.mm
index 094e6db..a98d7f3 100644
--- a/src/she/skia/skia_window_osx.mm
+++ b/src/she/skia/skia_window_osx.mm
@@ -24,18 +24,26 @@ public:
   gfx::Size clientSize;
   gfx::Size restoredSize;
 
+  Impl() {
+    closing = false;
+    scale = 1;
+    window = [OSXWindow new];
+    [window setCloseDelegate:this];
+  }
+
   void notifyClose() override {
     closing = true;
   }
 };
 
 SkiaWindow::SkiaWindow(EventQueue* queue, SkiaDisplay* display)
-  : m_impl(new SkiaWindow::Impl)
+  : m_impl(nullptr)
 {
-  m_impl->closing = false;
-  m_impl->scale = 1;
-  m_impl->window = [OSXWindow new];
-  [m_impl->window setCloseDelegate:m_impl];
+  dispatch_sync(
+    dispatch_get_main_queue(),
+    ^{
+      m_impl = new SkiaWindow::Impl;
+    });
 }
 
 SkiaWindow::~SkiaWindow()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list