• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSAlert runModal in outlineView:acceptDrop crashes with may not be invoked inside of transaction begin/commit pair
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSAlert runModal in outlineView:acceptDrop crashes with may not be invoked inside of transaction begin/commit pair
      • From: Rob Petrovec via Cocoa-dev <email@hidden>
  • Prev by Date: Re: How to parse a log file
  • Next by Date: Re: NSAlert runModal in outlineView:acceptDrop crashes with may not be invoked inside of transaction begin/commit pair
  • Previous by thread: Re: How to parse a log file
  • Next by thread: Re: NSAlert runModal in outlineView:acceptDrop crashes with may not be invoked inside of transaction begin/commit pair
  • Index(es):
    • Date
    • Thread