[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Occasional NSInternalInconsistencyException
From: |
Patryk Laurent |
Subject: |
Re: Occasional NSInternalInconsistencyException |
Date: |
Tue, 19 Nov 2019 07:34:23 -0800 |
> On Nov 18, 2019, at 09:16, Wolfgang Lux <address@hidden> wrote:
>
>> Am 18.11.2019 um 04:43 schrieb Patryk Laurent <address@hidden>:
>> “Uncaught exception NSInternalInconsistencyException, reason: registration
>> with registered client.”
>
> The error message itself is coming from NSDistributedNotificationCenter and
> it looks like it's caused by a race condition when two threads in your
> program are adding an observer to the distribution notification center at
> about the same time.
Thanks, Wolfgang. I find this surprising because my program is minimal (source
code below). I wasn’t getting this before, will look for what has changed...
Patryk
#import <AppKit/AppKit.h>
int main()
{
NSApplication *app;
app = [NSApplication sharedApplication];
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText:@"Hello alert"];
[alert addButtonWithTitle:@"All done"];
int result = [alert runModal];
if (result == NSAlertFirstButtonReturn) {
NSLog(@"First button pressed");
}
}