Okay, if you ignoring me and dumping all errors on Glib, then I decided to find and fix the error myself.
Everything turned out to be simple.
Error in function:
procedure TGtkMessageQueue.Lock;
begin
if InterlockedIncrement(fLock)=1 then
{$IFDEF USE_GTK_MAIN_OLD_ITERATION}
EnterCriticalsection(FCritSec);
{$ELSE}
g_main_context_acquire(FMainContext);
{$ENDIF}
end;
The fact is that, according to the documentation, the g_main_context_acquire function returns a boolean variable(bool) indicating the success of the function.
Those. an attempt to make g_main_context_acquire (in fact Lock) may fail.
Your code doesn't account for this.
Need to do:
procedure TGtkMessageQueue.Lock;
var
b: Boolean;
begin
if InterlockedIncrement(fLock)=1 then
{$IFDEF USE_GTK_MAIN_OLD_ITERATION}
EnterCriticalsection(FCritSec);
{$ELSE}
repeat
b := g_main_context_acquire(FMainContext);
//You can insert Sleep or something like that, but not required.
until(b);
{$ENDIF}
end;
I.e. we "lock" in a loop, until the lock is triggered.
I ask you to change this the next version.