diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-09-28 11:53:47 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-09-28 11:53:47 +0200 |
commit | 0f8a478c72e441bd612b0fef685e8c02aeb7cfc5 (patch) | |
tree | 698db724ff8df04d58f3cd245789b6f0d02a133f | |
parent | b178c4deff9bb8447408c5b469e658bc813075ae (diff) | |
download | fpGUI-0f8a478c72e441bd612b0fef685e8c02aeb7cfc5.tar.xz |
msg queue thread safety. Added an additional safety measure.
-rw-r--r-- | src/corelib/fpg_msgqueue.inc | 13 |
1 files changed, 9 insertions, 4 deletions
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; |