View Issue Details

IDProjectCategoryView StatusLast Update
0037406LazarusWidgetsetpublic2020-07-26 09:45
ReporterCanineQwer Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
OSUbuntu/Fedora/other gtk2 base 
Product Version2.0.10 
Summary0037406: Error in PeekMessage
DescriptionThe error has already been localized, described and suggested how to fix it.
https://forum.lazarus.freepascal.org/index.php/topic,50628.15.html
I duplicate in to the screen.
Steps To ReproduceRun the attached project.
Additional InformationAnd please explain.
If I find some mistake again, should I write right here instead of on the forum?
TagsNo tags attached.
Fixed in Revisionr63655
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0035395 resolvedJuha Manninen Race condition in TGtk2WidgetSet (TGtkMessageQueue) 

Activities

CanineQwer

2020-07-22 20:15

reporter  

MomError.rar (127,927 bytes)
1.png (32,677 bytes)   
1.png (32,677 bytes)   

Bart Broersma

2020-07-22 21:49

developer   ~0124238

If you are uncertain something is a bug (or maybe even already fixed), ask in forum or mailinglist first.
Otherwise report it here directly.

CanineQwer

2020-07-22 22:42

reporter   ~0124241

Thank you for the clarification.
Then please look at the message above.
It describes the error, the reason and how to fix it.

Juha Manninen

2020-07-24 16:17

developer   ~0124304

All changes happen in SVN trunk. The code there is different since r62219, 2019-11-10. See the related issue.

 procedure TGtkMessageQueue.Lock;
 begin
   {$IFDEF USE_GTK_MAIN_OLD_ITERATION}
   if InterlockedIncrement(fLock)=1 then
     EnterCriticalsection(FCritSec);
   {$ELSE}
   if GetCurrentThreadId = MainThreadID then
     g_main_context_acquire(FMainContext)
   else
     EnterCriticalsection(FCritSec);
   {$ENDIF}
 end;

Do you think it could be simplified again?
In future please learn to make patches against trunk.
 https://wiki.freepascal.org/Creating_A_Patch
New developers are always welcome.

CanineQwer

2020-07-25 22:19

reporter   ~0124332

g_main_context_acquire может завершиться ошибкой.
В этом случае он вернет False.
Я советую делать g_main_context_acquire в цикле, пока он не вернет True.

CanineQwer

2020-07-25 22:19

reporter   ~0124333

g_main_context_acquire may fail.
In this case, it will return False.
I advise doing g_main_context_acquire in a loop until it returns True.

CanineQwer

2020-07-25 22:22

reporter   ~0124334

In my Lazarus2.0.10, the TGtkMessageQueue.Lock function looks different.
I can't say if your version of the code works, I'll check and unsubscribe in the next version of Lazarus.

Juha Manninen

2020-07-26 09:45

developer   ~0124337

I added the repeat ... until loop. Please test.
In the future please use Lazarus trunk (development version) when fixing bugs, and please learn to make patches.
 https://wiki.freepascal.org/Creating_A_Patch

Issue History

Date Modified Username Field Change
2020-07-22 20:15 CanineQwer New Issue
2020-07-22 20:15 CanineQwer File Added: MomError.rar
2020-07-22 20:15 CanineQwer File Added: 1.png
2020-07-22 21:49 Bart Broersma Category LCL => Widgetset
2020-07-22 21:49 Bart Broersma Description Updated View Revisions
2020-07-22 21:49 Bart Broersma Additional Information Updated View Revisions
2020-07-22 21:49 Bart Broersma LazTarget => -
2020-07-22 21:49 Bart Broersma Widgetset GTK 2 => GTK 2
2020-07-22 21:49 Bart Broersma Note Added: 0124238
2020-07-22 22:42 CanineQwer Note Added: 0124241
2020-07-23 07:29 Juha Manninen Relationship added related to 0035395
2020-07-24 16:17 Juha Manninen Note Added: 0124304
2020-07-24 16:17 Juha Manninen Assigned To => Juha Manninen
2020-07-24 16:17 Juha Manninen Status new => assigned
2020-07-25 21:37 Juha Manninen Status assigned => feedback
2020-07-25 22:19 CanineQwer Note Added: 0124332
2020-07-25 22:19 CanineQwer Status feedback => assigned
2020-07-25 22:19 CanineQwer Note Added: 0124333
2020-07-25 22:22 CanineQwer Note Added: 0124334
2020-07-26 09:45 Juha Manninen Status assigned => resolved
2020-07-26 09:45 Juha Manninen Resolution open => fixed
2020-07-26 09:45 Juha Manninen Fixed in Revision => r63655
2020-07-26 09:45 Juha Manninen Widgetset GTK 2 => GTK 2
2020-07-26 09:45 Juha Manninen Note Added: 0124337