NSInternalInconsistencyException crash

Hi,

Using Xojo 2017r2.1, I get a crash when launching a Cocoa app via Terminal & passing parameters like reported in these 2 feedback cases :
<https://xojo.com/issue/37610>
and
<https://xojo.com/issue/37423>

According to Norman’ comment, I understood that we are not allowed to Quit while App.Event.Open is running…

So, at the end of the Open event, I added a timer with a single mode, a period of 100, and with a timer action “Quit”, hoping the timer action while run after the App.Event Open.

Not sure if this is s a good guess, but it works ! Tested with success on Maverick, Yosemite and High Sierra.

What do you think ? Is it a solid workaround ?

THanks, Fred

you could set autoquit property to true.

app.autoquit = true

so Xojo runtime quits the app.

or call

ExitMBS(0)

to quit the app without running Xojo’s destructors.

For future reference, if you paste the thing that Feedback.app gives you when you select “Copy Sharing Link” the forum will turn that into the link for you :slight_smile:

<[https://xojo.com/issue/37610](https://xojo.com/issue/37610)>

<https://xojo.com/issue/37610>

<[https://xojo.com/issue/37423](https://xojo.com/issue/37423)>

<https://xojo.com/issue/37423>

Thanks Christian.
Is it more secure than using a timer ?

Hi Tim, thanks for the tip. I edit my post and correct it.

[quote=401268:@FrdricQUOIREZ]Thanks Christian.
Is it more secure than using a timer ?[/quote]
Well, what happens is that the ExitMBS method will exit your app without calling the Xojo destructors. Using a Timer means that both your app quits regularly and the Xojo destructors get called. I do not know what goes on in the destructors, but I’d lean toward the Timer option just to be on the safe side.

I did some tests, and app.autoquit doesn’t for my needs.

ExitMBS(0) does, but as Tim mentioned, it might be safer to quit regularly, so I’ll stay with the timer approach for now.

Thanks, Fred

I just ran into the same issue with Arbed. Why the heck has this not been fixed, it’s been around for years. Damnit

It appears the condition for this bug is that it only happens when Quit is called from within the initial Open event. So, by either using a Timer (with Period 0) or even the NewDocument event, the Open Event is not running any more, and Quit can safely be called.