diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index 56c63fcb..5f6fdd98 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -1049,22 +1049,26 @@ void SetDebug(void *applicationPointer, int flag) { void AddContextMenu(struct Application *app, const char *contextMenuJSON) { // Guard against calling during shutdown if( app->shuttingDown ) return; - - AddContextMenuToStore(app->contextMenuStore, contextMenuJSON); + ON_MAIN_THREAD ( + AddContextMenuToStore(app->contextMenuStore, contextMenuJSON); + ); } void UpdateContextMenu(struct Application *app, const char* contextMenuJSON) { // Guard against calling during shutdown if( app->shuttingDown ) return; - - UpdateContextMenuInStore(app->contextMenuStore, contextMenuJSON); + ON_MAIN_THREAD( + UpdateContextMenuInStore(app->contextMenuStore, contextMenuJSON); + ); } void AddTrayMenu(struct Application *app, const char *trayMenuJSON) { // Guard against calling during shutdown if( app->shuttingDown ) return; - AddTrayMenuToStore(TrayMenuStoreSingleton, trayMenuJSON); + ON_MAIN_THREAD( + AddTrayMenuToStore(TrayMenuStoreSingleton, trayMenuJSON); + ); } void SetTrayMenu(struct Application *app, const char* trayMenuJSON) { @@ -1407,7 +1411,9 @@ void SetApplicationMenu(struct Application *app, const char *menuAsJSON) { } // Update menu - updateMenu(app, menuAsJSON); + ON_MAIN_THREAD ( + updateMenu(app, menuAsJSON); + ); } void processDialogIcons(struct hashmap_s *hashmap, const unsigned char *dialogIcons[]) { diff --git a/v2/internal/ffenestri/menu_darwin.c b/v2/internal/ffenestri/menu_darwin.c index da994dd7..f7829554 100644 --- a/v2/internal/ffenestri/menu_darwin.c +++ b/v2/internal/ffenestri/menu_darwin.c @@ -624,7 +624,7 @@ id createAttributedString(const char* title, const char* fontName, int fontSize, id attributedString = ALLOC("NSMutableAttributedString"); msg_id_id(attributedString, s("initWithString:attributes:"), str(title), dictionary); msg_reg(attributedString, s("autorelease")); - msg_reg(dictionary, s("release")); + msg_reg(dictionary, s("autorelease")); return attributedString; }