Threads and load pixmap causing problems

BlitzMax Forums/BlitzMax Programming/Threads and load pixmap causing problems

AdamRedwoods(Posted 2010) [#1]
Hi,

I've been struggling over this problem where I've been trying to load in images as a thumbnail and get them to display. I've created the code so that the loop is in it's own thread, so as we're loading the images in a folder, the code can go and do something else. Seems to work fine sometimes, and other times it will crash randomly on me. Seems to crash less in Debug mode.

I've spent long hours isolating the problem, and I've come up with that it's something in the LoadPixmap. I've tried playing with streams but those seem to be ok. I've played with image size-- smaller files seem to do ok. Files over 500kb or so (family albums) tend to crash after a little while.

I've set up this code, and things are really screwy on my system (WinVista64)-- so I'm sure there's mistakes, but the problem still exists.

I've also noticed that if I add more garbage collectors, I can sometimes make the problem more isolated.

Anyways, I think there's a problem that's beyond my code.
I've also tried using Brucey's FreeImage, and I get the same random crashes.

The crashes are usually the code locking up with no errors. In debug mode, the code sometimes works (at least crashes less often).

I'd appreciate any help, and any suggestions for what the problem may be. It'd clear my sanity to get this working without random crashes.

The code (excuse the mess):


If there are mistakes caught in the code (I consolidated and trimmed this code from other files) I'll update the above code, but even in my cleaner code I had random crashes.