Only on Windows: I quit my app, and then I see this.
Problem Event Name: BEX
Application Name: DebugMyApp.exe
Application Version: 2.9.97.0
Application Timestamp: 5a203eab
Fault Module Name: StackHash_0a9e
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Offset: 00000000
Exception Code: c0000005
Exception Data: 00000008
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Appears to be something like trying access a pointer to an object that has been destroyed. I’m not running any threads. Any ideas what is causing this?
P.S. This is Xojo2017r3 on Windows 7, and here’s a clue for the Xojo team: earlier versions of Xojo that will open this project are 2015 and above, and in those earlier versions of Xojo, this same exact BEX crash happens immediately after the project BOOTS, not when it quits (can’t quit it normally because I can never get it to run).
Also FYI, the project was first written in RB over a decade ago, and has been maintained to work in every next version of RB and Xojo since, although sometimes it would not work in the currently released version and I had to compile with an old version for a while. Why this is happening now and it didn’t happen before, I don’t know.
You should file a bug report in Feedback.
I woke up with this workaround in my head, and it works:
In App.CancelClose, I put:
#if TargetWin32 then
Xojo.Core.Timer.CallLater( 100, AddressOf KillWindowsProcess )
return true
#endif
and the KillWindowsProcess method is:
dim s as new shell
dim n as string = "MyAppName"
#if DebugBuild then n = "Debug" + n
s.Execute( "Taskkill /IM "+n+".exe /F" )
This way the app “quits” on Windows (is actually now forcibly terminated) without crashing. Mac quits as expected.
Thanks, Greg. None of my other apps have this problem, and I don’t guess there is a way to reproduce it with a simple example project. This is a very old project and has all kinds of bad practises in it, like windows all using implicit instance and show/hide management, so I am chalking it up to bad design. My programming has gotten a lot better since RB version 2, and I’m happy to let Xojo worry about more important things than diving into my horrible old code Thanks again!
This should work too, just in case some other app shares your app name.
Declare Function GetCurrentProcessId Lib "Kernel32" () As UInt32
Dim PID As UInt32 = GetCurrentProcessId()
Dim s As New shell
s.Execute("Taskkill /PID " + str(PID) + " /F")
[quote=375907:@]This should work too, just in case some other app shares your app name.
Declare Function GetCurrentProcessId Lib "Kernel32" () As UInt32
Dim PID As UInt32 = GetCurrentProcessId()
Dim s As New shell
s.Execute("Taskkill /PID " + str(PID) + " /F")
[/quote]
Yes, that’s even better. Thank you