Modify built in extensions to be thread safe

This commit is contained in:
Michael
2024-07-07 11:58:10 -04:00
parent e2356c09bc
commit 94cda5b4ee
3 changed files with 42 additions and 11 deletions
@@ -112,6 +112,17 @@ NS_ASSUME_NONNULL_BEGIN
- (void)userInputCommandInvokedOnClient:(IRCClient *)client
commandString:(NSString *)commandString
messageString:(NSString *)messageString
{
XRPerformBlockAsynchronouslyOnMainQueue(^{
[self _userInputCommandInvokedOnClient:client
commandString:commandString
messageString:messageString];
});
}
- (void)_userInputCommandInvokedOnClient:(IRCClient *)client
commandString:(NSString *)commandString
messageString:(NSString *)messageString
{
IRCChannel *channel = mainWindow().selectedChannel;
@@ -47,6 +47,17 @@ NS_ASSUME_NONNULL_BEGIN
- (void)userInputCommandInvokedOnClient:(IRCClient *)client
commandString:(NSString *)commandString
messageString:(NSString *)messageString
{
XRPerformBlockAsynchronouslyOnMainQueue(^{
[self _userInputCommandInvokedOnClient:client
commandString:commandString
messageString:messageString];
});
}
- (void)_userInputCommandInvokedOnClient:(IRCClient *)client
commandString:(NSString *)commandString
messageString:(NSString *)messageString
{
IRCChannel *channel = mainWindow().selectedChannel;
@@ -73,6 +73,17 @@ NS_ASSUME_NONNULL_BEGIN
- (void)userInputCommandInvokedOnClient:(IRCClient *)client
commandString:(NSString *)commandString
messageString:(NSString *)messageString
{
XRPerformBlockAsynchronouslyOnMainQueue(^{
[self _userInputCommandInvokedOnClient:client
commandString:commandString
messageString:messageString];
});
}
- (void)_userInputCommandInvokedOnClient:(IRCClient *)client
commandString:(NSString *)commandString
messageString:(NSString *)messageString
{
/* Throw error if user tries to invoke a command that requires the
user to be connected to a ZNC bouncer */
@@ -128,20 +139,18 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
XRPerformBlockSynchronouslyOnMainQueue(^{
SFCertificateTrustPanel *panel = [SFCertificateTrustPanel new];
SFCertificateTrustPanel *panel = [SFCertificateTrustPanel new];
[panel setDefaultButtonTitle:TXTLS(@"Prompts[aqw-q1]")];
[panel setDefaultButtonTitle:TXTLS(@"Prompts[aqw-q1]")];
[panel setAlternateButtonTitle:nil];
[panel setAlternateButtonTitle:nil];
[panel beginSheetForWindow:[NSApp mainWindow]
modalDelegate:nil
didEndSelector:NULL
contextInfo:NULL
certificates:(__bridge NSArray *)certificateArray
showGroup:YES];
});
[panel beginSheetForWindow:[NSApp mainWindow]
modalDelegate:nil
didEndSelector:NULL
contextInfo:NULL
certificates:(__bridge NSArray *)certificateArray
showGroup:YES];
CFRelease(certificateArray);
}