Cocoa Menubar freezes oF update

Hi!
I’ve added some new items to the menubar of the app I’m currently working on.
I’m mixing some videos and drawing the result in a loop.
When I click on the menubar and when I select an option that presents a cocoa dialog/window the mixing of the video freezes. It looks like the update and draw methods aren’t being executed.
This is probably because both cocoa guy and oF code are executed on the same thread.
I’ve tried to decouple them and run cocoa guy and my rendering loop on different threads but it doesn’t work.
Any ideas?
Thanks for any input on this.

can we see some code?

Sure. I’m concentrating all my cocoa code in a .m file with type ‘Objective-C++ Source’. In it I got a obj-c object.

The method to change the Menu bar is something like:

- (void) setupMenuBar {
    NSMenuItem *fileMenuItem = [[NSMenuItem alloc] init];
    [fileMenuItem setTitle:@"File"];
    NSMenu *fileMenu = [[NSMenu alloc] init];
    [fileMenu setTitle: @"File"];
    fileMenuItem.submenu = fileMenu;
    [[NSApp mainMenu] insertItem:fileMenuItem atIndex:1];
   
	SEL newSetSel;
	newSetSel = @selector(handleNewSet:);
	NSMenuItem *newSet = [[NSMenuItem alloc] initWithTitle:@"New Set"
                                                    action:newSetSel
                                             keyEquivalent:@"n"];
	[newSet setTarget:self];
	[newSet setAction:newSetSel];
	[newSet setEnabled:YES];
	[fileMenu addItem:newSet];
}

The method to be called by the selector is in the same object and it’s something like:

- (void) handleNewSet:(id) sender {
 ...
}

I call the method to change the menubar on my ofApp class on the setup method. I first init the obj-c object and then I call the method:

cocoaHandler = [[CocoaHandler alloc] init];
[cocoaHandler setupMenuBar];

To the this working properly, I believe I need to redo the way ofRunApp() works so I can split the cocoa and OpenGL into their own threads. Is this right?