From 0f8a478c72e441bd612b0fef685e8c02aeb7cfc5 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 28 Sep 2010 11:53:47 +0200 Subject: msg queue thread safety. Added an additional safety measure. --- src/corelib/fpg_msgqueue.inc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_msgqueue.inc b/src/corelib/fpg_msgqueue.inc index 386178d9..00862cc1 100644 --- a/src/corelib/fpg_msgqueue.inc +++ b/src/corelib/fpg_msgqueue.inc @@ -86,10 +86,15 @@ end; function fpgGetFirstMessage: PfpgMessageRec; begin - if UsedFirstMessage <> nil then - Result := @(UsedFirstMessage.msg) - else - Result := nil; + fpgApplication.Lock; + try + if UsedFirstMessage <> nil then + Result := @(UsedFirstMessage.msg) + else + Result := nil; + finally + fpgApplication.Unlock; + end; end; procedure fpgInitMsgQueue; -- cgit v1.2.3-70-g09d2