View Issue Details

IDProjectCategoryView StatusLast Update
0037924LazarusLCLpublic2020-10-26 08:12
ReporterDavid Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinux 
Product Version2.1 (SVN) 
Summary0037924: GTK "critical" messages generated by TabControl Tabs
DescriptionA message "Gtk-[1;35mCRITICAL[0m **:[34m16:18:25.362[0m: IA__gtk_widget_realize: assertion 'GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed" when a Tab within a TabControl is created. It does not seem to be associated with any other bad behavior but the word, "critical" does create some concern with end users.

It appears to be associated with revision r63897 where a line was added to gtk2proc.inc at 4070 calling gtk_widget_realize. It dealt with 0030385, I have not provided a patch because I guess the line does need to be there, somehow differently ?

This GTK message even pops up when starting Lazarus itself, if it was built from recent source. Not a good look.

Was introduced into trunk about three weeks ago.
Steps To ReproduceOn a form, put a TabControl, right click the control and choose to add a tab or two.
Run the form, error messages appear on console output.


TagsNo tags attached.
Fixed in Revisionr64003
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0030385 closedMattias Gaertner gtk2: Setting the form shape requires at least one TWinControl on form 

Activities

Anton Kavalenka

2020-10-14 15:04

reporter   ~0126294

Patch fixes the assertions
gtk2region.diff (719 bytes)   
Index: lcl/interfaces/gtk2/gtk2proc.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2proc.inc	(revision 64001)
+++ lcl/interfaces/gtk2/gtk2proc.inc	(working copy)
@@ -4067,11 +4067,13 @@
 begin
   if Widget <> nil then 
   begin
-    gtk_widget_realize(Widget); // associate with window
     If not GTKWidgetIsA(PGTKWidget(Widget), GTK_Layout_Get_Type) then
       Result := PGTKWidget(Widget)^.Window
     else
+    begin
+      gtk_widget_realize(Widget); // associate with window
       Result := PGtkLayout(Widget)^.bin_window;
+    end;
     if (Result=nil) and (GTK_WIDGET_NO_WINDOW(Widget)) then
       Result:=gtk_widget_get_parent_window(Widget);
   end else
gtk2region.diff (719 bytes)   

Juha Manninen

2020-10-14 20:17

developer   ~0126305

Applied, thanks.

David

2020-10-15 02:26

reporter   ~0126318

Hmm, interesting. Anton's patch has fixed the problem with my test application. But I am still seeing those messages as Lazarus, the IDE starts up. So, something else is going on here, I am not sure what.

Commenting out the ~realize() line (and rebuilding) does make the problem go away completely. So, some other component is being tickled I am guessing.

Davo

Joeny Ang

2020-10-21 10:48

reporter   ~0126440

Hi, maybe limiting it to toplevel windows will do the job :)
gtk2region-pt2.patch (537 bytes)   
--- lcl/interfaces/gtk2/gtk2proc.inc.64032
+++ lcl/interfaces/gtk2/gtk2proc.inc
@@ -4071,7 +4071,9 @@
       Result := PGTKWidget(Widget)^.Window
     else
     begin
-      gtk_widget_realize(Widget); // associate with window
+      if GtkWidgetIsA(gtk_widget_get_toplevel(Widget), gtk_window_get_type) and
+        not gtk_widget_realized(Widget) then
+        gtk_widget_realize(Widget); // associate with window
       Result := PGtkLayout(Widget)^.bin_window;
     end;
     if (Result=nil) and (GTK_WIDGET_NO_WINDOW(Widget)) then

gtk2region-pt2.patch (537 bytes)   

Anton Kavalenka

2020-10-21 16:09

reporter   ~0126444

@Joeny Ang
Your patch is even better, as it properly handles all kinds of Child widgets.
At least TTabControl and TPaeControl does not cause gtk assertions

David

2020-10-26 08:11

reporter   ~0126562

I am not sure if Joeny's patch has been applied but I am not seeing this problem with current trunk !

Thanks !

(I will close it now).

David

2020-10-26 08:12

reporter   ~0126563

Seems all good !

Issue History

Date Modified Username Field Change
2020-10-14 11:52 David New Issue
2020-10-14 15:04 Anton Kavalenka Note Added: 0126294
2020-10-14 15:04 Anton Kavalenka File Added: gtk2region.diff
2020-10-14 15:53 Juha Manninen Relationship added related to 0030385
2020-10-14 15:56 Juha Manninen Assigned To => Juha Manninen
2020-10-14 15:56 Juha Manninen Status new => assigned
2020-10-14 20:17 Juha Manninen Status assigned => resolved
2020-10-14 20:17 Juha Manninen Resolution open => fixed
2020-10-14 20:17 Juha Manninen Fixed in Revision => r64003
2020-10-14 20:17 Juha Manninen LazTarget => -
2020-10-14 20:17 Juha Manninen Widgetset GTK 2 => GTK 2
2020-10-14 20:17 Juha Manninen Note Added: 0126305
2020-10-15 02:26 David Note Added: 0126318
2020-10-21 10:48 Joeny Ang Note Added: 0126440
2020-10-21 10:48 Joeny Ang File Added: gtk2region-pt2.patch
2020-10-21 16:09 Anton Kavalenka Note Added: 0126444
2020-10-26 08:11 David Note Added: 0126562
2020-10-26 08:12 David Status resolved => closed
2020-10-26 08:12 David Note Added: 0126563