Browse Source

Merge branch 'master' into extra-gl-locks

pull/2108/head
Dan Walmsley 7 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;
@end
@implementation ThreadingInitializer
pthread_mutex_t mutex;
pthread_cond_t cond;
{
int _fds[2];
}
- (void) runOnce
{
pthread_mutex_lock(&mutex);
pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
char buf[]={0};
write(_fds[1], buf, 1);
}
- (void) do
{
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cond, NULL);
pipe(_fds);
[[[NSThread alloc] initWithTarget:self selector:@selector(runOnce) object:nil] start];
pthread_mutex_lock(&mutex);
pthread_cond_wait(&cond, &mutex);
pthread_mutex_unlock(&mutex);
pthread_cond_destroy(&cond);
pthread_mutex_destroy(&mutex);
char buf[1];
read(_fds[0], buf, 1);
close(_fds[0]);
close(_fds[1]);
}

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

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

Loading…
Cancel
Save