NSAlert runModal in outlineView:acceptDrop crashes with may not be invoked inside of transaction begin/commit pair
NSAlert runModal in outlineView:acceptDrop crashes with may not be invoked inside of transaction begin/commit pair
- Subject: NSAlert runModal in outlineView:acceptDrop crashes with may not be invoked inside of transaction begin/commit pair
- From: Michael Kloske via Cocoa-dev <email@hidden>
- Date: Sat, 31 Oct 2020 13:24:48 +0100
Hello,
I have an OutlineView. Whenever I drag and drop a child item within the
Outline-View my application crashes when I open do an "NSAlert runModal"
like in the code below:
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <
NSDraggingInfo >)info item:(id)item childIndex:(NSInteger)index
{
...
1 if(needToAskUser)
{
2 NSAlert *alert = [[NSAlert alloc] init];
3 // .. set some texts and buttons in alert
4 [alert runModal];
}
}
In line 4 the app crashes with the following uncaught exception:
[General] -[NSAlert runModal] may not be invoked inside of transaction
begin/commit pair, or inside of transaction commit (usually this means
it was invoked inside of a view's -drawRect: method.)
I have a tree like this:
Top Level 1
- Child Item A
- Child Item B
Top Level 2
- Child Item C
...
The problem occurs only, when I drag one of the Child Items within the
same view. It does not matter whether I move Child Item A below Child
Item B or if I move it to another Top Level item, for example below
Child Item C.
Moving the block into a call to
dispatch_async(dispatch_get_main_queue(), ^{ }); did also not help.
Has anyone any idea what the problem is?
Best regards,
Michael Kloske
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden