StartDrawing()-StopDrawing() sequence

Windows specific forum
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

StartDrawing()-StopDrawing() sequence

Post by eriansa »

I have this program (SQ4² -> www.sq4.net) that i am rewritting.

I have a UI-thread and a realtime-thread (Soundcard->AsioDriver)
Everything is working fine EXCEPT (in some rare cases) when there is a WM_Paint.


If I debug I sometimes get : "Stopdrawing() must be called before StartDrawing()..."

I am sure the realtime-thread doesn't call any UI-repaint procedures. It only postmessage_() to do the UI-update.

The result of this error (when not debugging) is a memory read error on procedurereturn from the realtime thread. (It must have something to do with the stack, i think)

Anybody any idea what could cause this behaviour?

thanks alot,

eric
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

I haven't looked at your source because I couldn't get your site but I can tell you that I have had to reorganize programs of my own that open startdrawing() blocks in threads to make absolutely sure that no other drawing could be taking place in the main program when they start drawing because PB doesn't distinguish between threads - It dies if two startdrawing() blocks get opened at the same time, two different threads or not. One could hope that a future version of PB will be made thread-safe for drawing blocks but for now we just have to work around it. Are you sure you're not drawing something somewhere?
BERESHEIT
Post Reply