wxMax and Multi-Threading

BlitzMax Modules Forums/Brucey's Modules/wxMax and Multi-Threading

Brucey, should I be able to use wxMax with a Multi-Threaded BlitzMax app? Here is what I have so far:

I wrote an App using wxWidgets. Got it all working. Then decided I wanted one portion of it to be in a separate thread.

I built all of my modules Threaded (including all the wxMax modules). Then when I set my App to compile with threading, the wxApp.Run fails when I shutdown. I have not even used any threading yet.

Have you run across this? Should I even be able to do this?

TBH, I haven't tried running anything wxMax related with threading/new GC enabled.
There are no reasons I can think of why it wouldn't work, as wxWidgets already comes with it's own threading functions.

Do you have any idea of the errors being generated on shutdown?

It just says:

Unhandled Exception:Unhandled Memory Exception Error

And points to:

wx.mod/base.bmx

at this spot (the arrows indicate the line for the error):

Type wxObject

	Field wxObjectPtr:Byte Ptr

	Function _Free(obj:wxObject)
		' WARNING... we free wxObjectPtr NOW, just in case any of the subclasses have a Free() method, where
		' the probably shouldn't have.
		obj.wxObjectPtr = Null
		
>>>>		obj.Free()
	End Function

	Method Free()
	End Method
	
End Type


Edit to add:

The funny part is, I have a line where I am deleting a file. If I comment out that line, it works, if that line stays in, I get the error. Makes no sense as the file is just a random file on the drive, not having anything to do with the app, and I am not deleting it right before closing (causing a race condition or anything). And I am using the standard Blitz DeleteFile command to delete it.

Hmmm, some of the samples also get this same error when I run them with Threaded Build turned on. And I haven't changed anything in them. For example, text.bmx.

So, it seems that maybe wxMax is not Multi-Threaded Capable?!?!

If you can find a solution to this, it would be great. But, I think I can get away with staying in single Thread Mode and using wxProcess and kicking off new processes to do the part I wanted to Multi-Thread.

From what I have found so far, the errors are appearing inside wxWidgets itself. Perhaps it is not happy running with the new GC.

I'll dig around a bit further though.

Thanks Brucey...

I was thinking I might use wxProcess and wxDDEClient/Server or wxClient/Server to make my spawned processes communicate with my main app. But I don't see them. Have you not done the interprocess communications widgets? or are they hidden in one of the mods?

Thanks again. wxMax is great.