SelectFolder Dialog not Closing

Running MacOS 10.14.3

I have a routine using the SelectFolderDialog class. I call it with showmodal, but when the folder is chosen, and the action button is clicked, the folder is returned, but the dialog window does not close.

dim destination as FolderItem
dim dlg as SelectFolderDialog

dlg = new selectFolderDialog
dlg.Title = "Select Source Folder "
dlg.ActionButtonCaption =“Select”
dlg.PromptText = “Select the volume or folder to that contains images to be processed”

destination = dlg.ShowModal

What am I not doing here?

What are you doing just after dlg.ShowModal? It might be that whatever you’re doing is so CPU intensive that the dialog isn’t be removed.

Happens to me all the time when debugging.
Is this in debug or released app?

  To Bob:

Once I get the folder, I store it as a target to save converted images and I begin a process to recurse through a directory tree and convert images from tiff to jpeg. Is there some way to force the dialog to close before I start the conversion process?

To Jeff:
This is happening both in the debugger and the compiled version of the app. This is very annoying. There is not even a .close command to call on this, after the folderitem has been handed off.

Is this process in a thread? If not, it should be so the UI doesn’t lock up.

try setting dlg = nil once you have stored the folderitem into a variable.

[code]dim destination as FolderItem
dim dlg as SelectFolderDialog

dlg = new selectFolderDialog
dlg.Title = "Select Source Folder "
dlg.ActionButtonCaption =“Select”
dlg.PromptText = “Select the volume or folder to that contains images to be processed”

destination = dlg.ShowModal

dlg = nil
//now do stuff[/code]

If it were in a thread, he wouldn’t be able to show a dialog anyway.

You miss my point. You can start the thread right after the dlg.showmodal. Trust me, I know a thing or two about threads and UI.

No the process is not in a thread-- I will try that.
Thanks!

Some months ago there was a blog post from Ulrich Bogun to do a dialog with a delegate as workaround.

Shouldn‘t that have been fixed by now???

I don’t think Xojo regards this as bug but as feature from macOS.

Checking Feedback I found a verified bug http://feedback.xojo.com/case/49730 which is only for debugging.

Ha yes. Oddly enough this is what I do. Except that it’s not, initially, a dialog. I put up a small window to get the info I need from the user (using a dialog at that point), then launch the thread (or not) once the user clicks my Go button (and close the small window).

I have this happen on 10.12.x, 10.13.x and 10.14.x, even with Objective-C applications.

What’s interesting to me is when it happens; the path to the file is garbage, which make me believe that this is a bug in the macOS where the xpc.opensave service (or whatever it’s called) gets buggered. Normally a restart fixes it.

Happily—
I put the process in a thread and the dialog closes (eventually). I appreciate everyone’s help on this. If I would only do as I am supposed to do, and not try to take shortcuts, I suppose I would not be having this conversation.

Well, sometimes you don’t know what you’re supposed to do until you try it and it goes wrong.

My XDC session is nominally titled “Xojo Design Mistakes” but it’s really “Thankfully time travel hasn’t been invented or my future self would go back in time and strangle my past self for such stupid mistakes.”