This is a bug, which could happen in every Xojo app and may even do so with built-in plugins.
The problem is that you may call a method, which yields CPU time to other threads in the Xojo app.
This may run a timer, which itself runs another plugin method, which yields. And that causes a crash.
In my opinion this one should get some attention as it affects all targets.
The crash report is from me. I have a very simple SQLite database. I wanted to use the multithread versions of the MBS plugin to avoid showing the beachball. There is a lot of data that is written to the database. Write a couple of thousand times and get a nice crash. Because of the bug I have to open an close the database for each write operation.
Calling code:
call ConnectToDatabaseLocalMBS
if not ConnectedToSQLite then Return
WriteLocalMBS(theRecID, MessageBody)
CloseSQLite
Writing to the database:
dim thePreparedStatement as SQLPreparedStatementMBS = SQLiteIndexDBMBS.Prepare("INSERT INTO bodyindex(docid, messagebody) VALUES(" + str(theRecID) + ", ?)")
thePreparedStatement.BindType(0, thePreparedStatement.kTypeString)
thePreparedStatement.SQLExecuteMT(MessageBody)
SQLiteIndexDBMBS.CommitTransaction
thePreparedStatement = Nil