SQLDatabaseMBS.ConnectMT crash in Linux

I have a method which is passed a SQLDatabaseMBS database and checks if it is non-nil, is alive, is connected, etc and if true returns the existing live database, otherwise re-connects or builds all the settings afresh. This means I can have one method to define, connect and reconnect to any database. Normally the tempSQLDatabaseMBS would be passed in, but I have DIM’ed it here to show the error.

I have extracted the snippet below that later checks if the database can connect. In macOS and Windows the code works without crashing and fails to connect (as it should). But in Linux the tempSQLDatabaseMBS.ConnectMT function crashes the app totally (not trapping an error).

It would be good if Christian could enable this to fail gracefully (I.e. return false) rather than kill the app in Linux. :wink:

[code]Dim tempSQLDatabaseMBS As New SQLDatabaseMBS

if tempSQLDatabaseMBS.ConnectMT then 'app crashes on this line in Linux only
MsgBox “We connected”
MsgBox “We failed to connect” 'correct answer
end if[/code]

Let me test here

Any details?
Plugin version? Xojo Version? 32 or 64bit?

I do see in a test here that we raise an exception, but it’s not caught anywhere!

Exceptions need to be enabled:

tempSQLDatabaseMBS.RaiseExceptions = true

The latest MBS pre-release v2 and 64-bit. I ran it on Linux Mint. I’ll give that a try.

Sorry, but even with the RaiseExceptions set to true the app still crashes. I placed a try…end try wrapper, but it still crashes and is not caught.

[code]Dim tempSQLDatabaseMBS As New SQLDatabaseMBS

tempSQLDatabaseMBS.RaiseExceptions = True
if tempSQLDatabaseMBS.ConnectMT then 'Linux app still crashes on this line despite try…end try
MsgBox “We connected”
MsgBox “We failed to connect” 'correct answer
end if

end try[/code]

I found a bug with file handling, which I fix for future.
But the exception is a different thing, I think.

Seems like the C++ exception handling fails and causes an abort, as you can see in gdb.

I have removed this code in the meantime (for Linux only), so it will recreate the database definition (on Linux) if it becomes disconnected, rather than just reconnect. Thank you.

Fixed for next prerelease. Sorry for that issue.

Please try 17.6pr3:

Yes, 176pr3 fixed the problem. Thank you.