Modal windows problems


I have problems with ShowModal method.
The problem is that one of my modal windows calls another modal window by using ShowModal method.
This mostly works fine, except sometimes when it causes a crash.
The crashes happen consistently, but at random occurrences (meaning that my app crashes eventually while repeatedly doing the same thing).

In an example crash I have a modal window that was show by using ShowModal statement.
In this window I have a list that, when double-clicked, creates and shows another modal window by using ShowModal statement (based on the element clicked).
Clicking on the elements of this list repeatedly (after closing the modal window which was opened) eventually causes a crash.
I am attaching a link to of stack trace on Mac of an example crash.

We are using XOJO Version 2017 1.1

Whilst moving our app from Carbon to Cocoa I have noticed that modal windows suffer from some very weird issues. They could be OS issues but the frequency I run into them and the fact that other apps don’t show the same problem makes me think that they are Xojo framework issues.

First, if you can repeat this in a standalone project I suggest that you create a Feedback case so at least Xojo know about it.

Things you could try…

  1. Rather than opening the second modal dialog from the double-click event, use the double-click event to start a very short timer that opens the second dialog.

  2. If you have any #pragmas in your double-click event try removing them as they could be masking an issue in your code.

  3. If you are using timers to close windows / dialogs automatically, be careful as there is at least one bug doing this.

Or don‘t use two modal windows, just one witha PagePanel.

Thanks for the quick answer guys.
I do not have any non-user initiated events and no pragmas.
I tried the timer (after double click, wait 200 milliseconds before showing the window) but I still get the crash -
I can do a workaround where I make a duplicate of first window which is non-modal in certain cases (we had other problems with ShowModal and this workaround helped), but this takes a long time (and destabilizes our system), which I was trying to avoid.
Thanks anyway.