Browse Source

Merge branch 'master' into extra-gl-locks

pull/2108/head
Dan Walmsley 8 years ago
parent
commit
c2a71f005d
  1. 24
      native/Avalonia.Native/src/OSX/main.mm
  2. 4
      native/Avalonia.Native/src/OSX/window.mm

24
native/Avalonia.Native/src/OSX/main.mm

@ -32,27 +32,23 @@ public:
- (void) do; - (void) do;
@end @end
@implementation ThreadingInitializer @implementation ThreadingInitializer
{
pthread_mutex_t mutex; int _fds[2];
pthread_cond_t cond; }
- (void) runOnce - (void) runOnce
{ {
pthread_mutex_lock(&mutex); char buf[]={0};
pthread_cond_signal(&cond); write(_fds[1], buf, 1);
pthread_mutex_unlock(&mutex);
} }
- (void) do - (void) do
{ {
pthread_mutex_init(&mutex, NULL); pipe(_fds);
pthread_cond_init(&cond, NULL);
[[[NSThread alloc] initWithTarget:self selector:@selector(runOnce) object:nil] start]; [[[NSThread alloc] initWithTarget:self selector:@selector(runOnce) object:nil] start];
pthread_mutex_lock(&mutex); char buf[1];
pthread_cond_wait(&cond, &mutex); read(_fds[0], buf, 1);
pthread_mutex_unlock(&mutex); close(_fds[0]);
pthread_cond_destroy(&cond); close(_fds[1]);
pthread_mutex_destroy(&mutex);
} }

4
native/Avalonia.Native/src/OSX/window.mm

@ -1113,7 +1113,9 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
[self restoreParentWindow]; [self restoreParentWindow];
parent->BaseEvents->Closed(); parent->BaseEvents->Closed();
[parent->View onClosed]; [parent->View onClosed];
[self setContentView: nil]; dispatch_async(dispatch_get_main_queue(), ^{
[self setContentView: nil];
});
} }
} }

Loading…
Cancel
Save