mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 09:38:12 +02:00
LCL-GTK2: Fix PeekMessage, check if g_main_context_acquire returns True. Issue #37406.
git-svn-id: trunk@63655 -
This commit is contained in:
parent
7ed8696762
commit
4f228a7831
@ -142,28 +142,29 @@ end;
|
||||
|
||||
procedure TGtkMessageQueue.Lock;
|
||||
begin
|
||||
{$IFDEF USE_GTK_MAIN_OLD_ITERATION}
|
||||
{$IFDEF USE_GTK_MAIN_OLD_ITERATION}
|
||||
if InterlockedIncrement(fLock)=1 then
|
||||
EnterCriticalsection(FCritSec);
|
||||
{$ELSE}
|
||||
{$ELSE}
|
||||
if GetCurrentThreadId = MainThreadID then
|
||||
g_main_context_acquire(FMainContext)
|
||||
repeat
|
||||
until g_main_context_acquire(FMainContext) // This can return False.
|
||||
else
|
||||
EnterCriticalsection(FCritSec);
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TGtkMessageQueue.UnLock;
|
||||
begin
|
||||
{$IFDEF USE_GTK_MAIN_OLD_ITERATION}
|
||||
{$IFDEF USE_GTK_MAIN_OLD_ITERATION}
|
||||
if InterlockedDecrement(fLock)=0 then
|
||||
LeaveCriticalsection(FCritSec);
|
||||
{$ELSE}
|
||||
{$ELSE}
|
||||
if GetCurrentThreadId = MainThreadID then
|
||||
g_main_context_release(FMainContext)
|
||||
else
|
||||
LeaveCriticalsection(FCritSec)
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user