Page 1 of 1

StartDrawing()-StopDrawing() sequence

Posted: Mon Jul 25, 2005 12:42 pm
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

Posted: Mon Sep 12, 2005 3:44 am
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?