From: George H. <geo...@us...> - 2009-01-01 18:36:56
|
Update of /cvsroot/win32forth/win32forth/src/gdi In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22866/gdi Modified Files: gdiBase.f Log Message: Made Gdi objects thread safe and added code to free resources when disposing of dynamic objects. Index: gdiBase.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/gdi/gdiBase.f,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gdiBase.f 17 Dec 2008 08:27:17 -0000 1.10 --- gdiBase.f 1 Jan 2009 18:36:50 -0000 1.11 *************** *** 72,75 **** --- 72,77 ---- int hObject \ handle of the GDI object + int mylink + :M ZeroHandle: ( -- ) \ *G Clear the handle of the object. \n *************** *** 81,88 **** ClassInit: super ! ZeroHandle: self \ zero handle ! gdi-object-link link, \ link into list so we ! self , \ can send ourself messages ! ;M :M GetType: ( -- n ) --- 83,92 ---- ClassInit: super ! ZeroHandle: self \ zero handle ! (gdilock) ! gdi-object-link link, \ link into list so we ! self , \ can send ourself messages ! gdi-object-link @ to mylink ! (gdiunlock) ;M :M GetType: ( -- n ) *************** *** 134,137 **** --- 138,147 ---- ;M + : Unchain-gdi-object ( -- ) + (gdilock) mylink gdi-object-link un-link drop (gdiunlock) ; + + :M ~: ( -- ) + Destroy: self Unchain-gdi-object ;M + :M GetHandle: ( -- hObject ) \ *G Get the handle of the object. *************** *** 173,177 **** [getmethod] ZeroHandle: GdiObject do-objects ; ! :M destroy-gdi-objects: ( -- ) \ destory this object 0 SetHandle: self ;M --- 183,187 ---- [getmethod] ZeroHandle: GdiObject do-objects ; ! :M destroy-gdi-objects: ( -- ) \ destroy this object 0 SetHandle: self ;M *************** *** 182,185 **** --- 192,204 ---- unload-chain chain-add destroy-gdi-objects + : Unchain-gdi-dynamic-object ( addr -- ) + cell+ @ dup app-origin sys-here between if drop else Unchain-gdi-object then ; + + : Unchain-gdi-dynamic-objects ( -- ) + ['] Unchain-gdi-dynamic-object gdi-object-link do-link ; + + \ unload-chain chain-add dispose-gdi-dynamic-objects + initialization-chain chain-add-before Unchain-gdi-dynamic-objects + ;class \ *G End of gdiBase class *************** *** 206,215 **** : UnLinkGdiObject ( -- ) \ remove the GdiObject at the head of the gdi-object-link list ! gdi-object-link @ gdi-object-link un-link drop ; in-system : .gdi-objects ( -- ) \ w32f sys ! \ *G Display GDI objects whitch are currently defined. gdi-object-link @ begin dup --- 225,234 ---- : UnLinkGdiObject ( -- ) \ remove the GdiObject at the head of the gdi-object-link list ! (gdilock) gdi-object-link @ gdi-object-link un-link drop (gdiunlock) ; in-system : .gdi-objects ( -- ) \ w32f sys ! \ *G Display GDI objects which are currently defined. gdi-object-link @ begin dup |