Recent

Author Topic: Gtk-CRITICAL **: gtk_window_realize_icon: assertion 'info->icon_pixmap == NULL'  (Read 5950 times)

howardpc

  • Hero Member
  • *****
  • Posts: 4144
I successfully create a modal dialog form which serves my purpose, and closes without any memory leak.
However, on closing the dialog, I receive the error shown in the subject.
Does anyone know what could cause this, and how to avoid it?

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Are there any icons/images in your form? That error usually means that GTK is trying to draw something that isn't there.

ETA: Note that it *can* be the form's icon, though it's ... unusual, to say the least.
« Last Edit: November 04, 2018, 08:02:15 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
It is happening in what is basically a text-only dialog.
The only icons are a system close icon (drawn, I suppose, by internal LCL code, in the non-client area) since  the BorderStyle is bsDialog.
There are also stock icons on the Cancel and OK bitbuttons... again drawn by internal LCL code.
Could this be an LCL bug?

lucamar

  • Hero Member
  • *****
  • Posts: 4219
I haven't been able to reproduce it with any of my dialogs--Lazarus 1.8.4/3.0.4 - Kubuntu 14.04.

From what I have seen out there this is a rare error: I have been able to find only some (rather old and C) references for wxWidgets. Can you share your configuration and some (failing) example code?
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
See attached project.
The GTK error happens on Mint 18.3, 64-bit.
Laz 2.1.0 r59165M
« Last Edit: November 05, 2018, 12:05:19 am by howardpc »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Works OK here, though I had to delete DoubleBuffered and ParentDoubleBuffered from udlgform.lfm.

There is one potential problem in function GetUserResponsesDlgOK(): the dialog is never destroyed. Although it's a local var and, supposedly, freed on exit you should either make sure of it:

Code: Pascal  [Select][+][-]
  1. function GetUserResponsesDlgOK(const aCaption, aHeading: String;
  2.   aPrompts: TAnsiStringArray; out UserTexts: TAnsiStringArray;
  3.   anEditWidth: Integer): Boolean;
  4. var
  5.   dlg: TDialogForm;
  6.   i: Integer;
  7. begin
  8.   dlg := TDialogForm.Create(aCaption, aHeading, aPrompts, anEditWidth);
  9.   try
  10.     Result := dlg.ShowModal = mrOK;
  11.     case Result of
  12.       [. . . etc . . .]
  13.     end;
  14.   finally
  15.     dlg.Free;
  16.   end;
  17. end;

or use a global variable--kind of a singleton--in the implementation part. But then you'd have to take control initialization out of Create or, at least, add setters for the captions.

There are some other things (p.e. I wouldn't assume the owner to be Application) and all in all I wouldn't have done it like that but there doesn't seem to be any place to point to and say: "here's where it fails" so there may in fact be some bug in Lazarus 2.1 that isn't present in previous versions.

Sorry to not be able to help more.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Quote
Works OK here, though I had to delete DoubleBuffered and ParentDoubleBuffered from udlgform.lfm.
Do you mean it does not produce the gtk error using an earlier versions of Lazarus?
DoubleBuffered is just there for use on Windows. AFAIK it has no effect on Linux.
Quote
the dialog is never destroyed
It is never destroyed in the function call code, true. But Application is explicitly made the Owner in the inherited constructor (it is not assumed), so other LCL code takes care of freeing the dialog and its controls.
Thanks for taking the time to investigate.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Do you mean it does not produce the gtk error using an earlier versions of Lazarus?
DoubleBuffered is just there for use on Windows. AFAIK it has no effect on Linux.

No, it doesn't produce the error. And remember that I'm using Lazarus 1.8.4; it chokes on the DoubleBuffered properties.

Quote
It is never destroyed in the function call code, true. But Application is explicitly made the Owner in the inherited constructor (it is not assumed), so other LCL code takes care of freeing the dialog and its controls.

Yes, but if you free it when done you waste less memory. Just a question of tastes, I guess :)
« Last Edit: November 05, 2018, 11:02:11 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
I stripped it down to a do-nothing dialog project which still shows the issue with Laz 2.1.0 and submitted a bug report.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Code: Pascal  [Select][+][-]
  1. (tomboy-ng:3323): Gtk-CRITICAL **: 09:48:59.879: gtk_window_realize_icon: assertion 'info->icon_pixmap == NULL' failed

Hmm, I'm afraid I can reproduce it in a 1.8.4 install Howard.

Only in a specific case where I am opening a window that dos not normally produce that error message. Your post prompted my memory and I went looking.  I'll see if I can track down where it happens.....

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
OK, I doubt what I am seeing has any relation to your problem Howard.

In my case, its when I open up a KMemo component, do a dummy paste (see below) and KMemo, eventually tickles line 7451 of gtk2proc.inc. 

Code: Pascal  [Select][+][-]
  1. if gtk_selection_convert(ClipboardWidget, ClipboardTypeAtoms[ClipboardType], FormatID, TimeID)<>GdkFalse

This is far from a bare form ! And note there are no icons or pixmaps of any kind associated in any way with generating this warning. Its a paste operation.

"Dummy paste" -  :-[  :-[ I found that Kmemo would loose its first paste sometimes. So, during setup, I do a dummy paste, I'm going to clear it any way so it does no harm. But, as noted it appears to trigger that GTK warning in one specific instance of my app, not in normal use. So, I guess I need to try and find out whats different in this specific use. Sigh ....

The code it here, it happens in single note mode only in Linux (obviously!) but I really don't think its at all relevant to your issue.
https://github.com/tomboy-notes/tomboy-ng

Davo
« Last Edit: November 06, 2018, 12:43:18 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018