\r
implementation\r
uses\r
- baseunix,unix,lcore,unixutil;//,safewriteln;\r
+ baseunix,unix,lcore,unixutil,ltimevalstuff;//,safewriteln;\r
{$i unixstuff.inc}\r
\r
type\r
//than crash after over four billion\r
//windows have been made ;)\r
nextwindowhandle : qword = $100000000;\r
-{$i ltimevalstuff.inc}\r
+\r
\r
//findthreaddata should only be called while holding the structurelock\r
function findthreaddata(threadid : integer) : tthreaddata;\r
//we have to get the window procedure while the structurelock\r
//is still held as the window could be destroyed from another thread\r
//otherwise.\r
- windowproc := window.windowproc;\r
+ if window <> nil then begin\r
+ windowproc := window.windowproc;\r
+ end else begin\r
+ windowproc := nil;\r
+ end;\r
finally\r
structurelock.release;\r
end;\r
- if window <> nil then begin\r
+ if assigned(windowproc) then begin\r
result := windowproc(lpmsg.hwnd,lpmsg.message,lpmsg.wparam,lpmsg.lparam);\r
end else begin\r
result := -1;\r
\r
function PeekMessage(var lpMsg: TMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): WINBOOL;\r
begin\r
- result := getmessageinternal(lpmsg,hwnd,wmsgfiltermin,wmsgfiltermax,PM_REMOVE,true);\r
+ result := getmessageinternal(lpmsg,hwnd,wmsgfiltermin,wmsgfiltermax,wRemoveMsg,true);\r
end;\r
\r
function SetEvent(hEvent:THevent):WINBOOL;\r