View Issue Details

IDProjectCategoryView StatusLast Update
0036359LazarusLCLpublic2020-05-07 07:33
ReporterChris Rorden Assigned To 
Status newResolutionopen 
PlatformIntel i7 4790OSUbuntu 
Product Version2.1 (SVN) 
Summary0036359: Simple project with gtk2 widget set hangs on startup
DescriptionThis issue is seen with a clean install of Ubuntu 19.10. Same issue on two different machines (Ryzen with NVidia GPU, Intel with integrated GPU). Every single Lazarus application built to GTK2 is impacted, including the default Lazarus (until one rebuilds to QT5). Every Lazarus built GTK2 application pauses for 25 seconds at application launch. This behavior is unlike Ubuntu 18.04 and 16.04.

Making a most basic simple application using the gtk2 widget set hangs 25 seconds and eventually becomes responsive.

Walking through the debugger the program gets stuck in main event loop in TGtk2WidgetSet.AppProcessMessages as the while loop with g_main_context_pending/g_main_context_iteration appears to polling for messages but never returns for some reason.

Building the GTK2 "Hello world" application with C shows no delay in launching.

With Lazarus, the GTK2 applications show delay, but GTK3 and QT5 work fine. I realize there are no active GTK2 maintiners, but Lazarus is still distributed initially as GTK2, and the Ubuntu 18.04 LTS does not support Lazarus QT5 applications.

At first blush, this sounds like issue 35395, but switching the options toggled by that fix did not help.
TagsNo tags attached.
Fixed in Revision
WidgetsetGTK 2
Attached Files


related to 0036434 closedJuha Manninen QT5: GTK dependency 
related to 0037029 new Using TOpenDialog results in SIGESGV when program closed 


Juha Manninen

2019-11-25 17:47

developer   ~0119491

Does it happen also with earlier versions of Lazarus or was it introduced by some recent change in trunk?

Chris Rorden

2019-11-26 19:56

reporter   ~0119515

Same behavior for Lazarus 1.8.4 GTK2 as well as a hello world project built with Lazarus 1.8.4. Lazarus 1.6.4 shipped with FreePascal 3.0.2 rather than 3.0.4, so I am hesitant to try that version.

Juha Manninen

2019-11-28 17:56

developer   ~0119537

Ok, then it is all about Ubuntu 19.10 instead of some recent Lazarus change.

Chris Rorden

2019-12-02 17:39

reporter   ~0119590

I believe these,47125.0.html
are all variations of the same bug. I did have general freezing of the whole GUI when launching 19.10 until I did a sudo apt update followed by sudo apt upgrade, now I just have a 25 second pause every time a Lazarus-build GTK2 application is launched (the window appears, but labels and components not drawn). From the forums, it may be that people who upgrade from a prior version of Ubuntu do not see this, but it occurred in both my from scratch installs.

Chris Rorden

2019-12-02 18:10

reporter   ~0119591

Last edited: 2019-12-02 18:22

View 2 revisions

This page details solutions
 1.) launch program as super user ("sudo ./project1")
 2.) launch application with launch "dbus-launch --exit-with-session ./project1"
 3.) Run "sudo apt-get install appmenu-gtk2-module" and restart your computer - after this applications launch quickly

Chris Rorden

2019-12-06 13:54

reporter   ~0119662

I have reported this issue here
While it does not impact all GTK2 applications, it influences many, many of which were not developed with Lazarus. The short term solution seems to be to run run "sudo apt-get install appmenu-gtk2-module" and restart your computer. That permanently patches that computer. Unfortunately, this is not obvious to new users who encounter this problem.

For the moment, I would suggest we keep this issue open. There seem to be two alternatives that are not mutually exclusive:
 1. Ubuntu is updated to fix this issue at the source.
 2. Someone discovers the GTK2 call that causes this polling delay and we can mitigate this in Lazarus.

Issue History

Date Modified Username Field Change
2019-11-25 16:43 Chris Rorden New Issue
2019-11-25 17:44 Juha Manninen Relationship added related to 0035395
2019-11-25 17:47 Juha Manninen Note Added: 0119491
2019-11-26 19:56 Chris Rorden Note Added: 0119515
2019-11-28 17:56 Juha Manninen Note Added: 0119537
2019-12-02 17:39 Chris Rorden Note Added: 0119590
2019-12-02 18:10 Chris Rorden Note Added: 0119591
2019-12-02 18:22 Chris Rorden Note Edited: 0119591 View Revisions
2019-12-06 13:54 Chris Rorden Note Added: 0119662
2019-12-13 23:08 Juha Manninen Relationship added related to 0036434
2019-12-13 23:19 Juha Manninen Relationship deleted related to 0035395
2020-05-07 07:33 Juha Manninen Relationship added related to 0037029