Re: NSAlert runModal black window


Marco S Hyman
 

On Oct 29, 2018, at 12:04 AM, Chris Hanson <cmhanson@...> wrote:

On Oct 28, 2018, at 4:20 PM, Marco S Hyman <marc@...> wrote:

Sometimes it works. Other times I get a black window with only the app icon and the close button showing. This is a new issue, first noted while testing with Xcode 10.0 running on Mojave. I am not using the dark appearance.
My first assumption with symptoms like this is that there’s something trying to do UI from a background thread.
Good thought, but I don’t think that is the problem this time. The alert is created in a function diretly called called from

func tableView(_ tableView: NSTableView,
acceptDrop info: NSDraggingInfo,
row: Int,
dropOperation: NSTableView.DropOperation) -> Bool {
...
}

which is invoked when a file of the appropriate type is dragged and dropped onto a table view. I’m not aware of any threading issues with drag and drop.

It does seem to be some kind of timing issue, though. I can not reproduce it with 100% reliability. Example, setting a breakpoint at the call to alert.runModal() will usually make things work.

Marc

Join cocoa@apple-dev.groups.io to automatically receive all group messages.