View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0032258 | Lazarus | LCL | public | 2017-08-10 19:34 | 2017-08-20 01:00 |
Reporter | Benito van der Zander | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | unable to reproduce |
Status | resolved | Resolution | fixed | ||
Product Version | 1.8RC2 | ||||
Summary | 0032258: appindicators crash and gdk_pixbuf_save | ||||
Description | TUnityTrayIconHandle in unitywsctrls.pas saves the current application icon to a file (as pointless as that sounds) by calling gdk_pixbuf_save(GlobalIcon, PChar(GlobalIconPath), IconType, nil); in create and update. But gdk_pixbuf_save needs a null terminated list as fifth parameter ( https://sourcecodebrowser.com/gtkplus-p2.0-directfb/2.0.9.2/gdk-pixbuf_8h.html#a4de09d2e72f26a8c9e65dcc2a2904f05 ) and calling it with four parameters will always CRASH ! ( https://mail.gnome.org/archives/gtk-app-devel-list/2005-June/msg00314.html ) | ||||
Additional Information | I cannot reproduce it, but I have received a bug report for one of my programs: Thread 1 "videlibri" received signal SIGSEGV, Segmentation fault. strlen () at ../sysdeps/x86_64/strlen.S:106 106 ../sysdeps/x86_64/strlen.S: Datei oder Verzeichnis nicht gefunden. (gdb) backtrace #0 strlen () at ../sysdeps/x86_64/strlen.S:106 0000001 0x00007ffff665e4e3 in g_strdup () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 0000002 0x00007ffff71ae682 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 0000003 0x00007ffff71b1749 in gdk_pixbuf_save () from /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 0000004 0x000000000089df84 in ?? () 0000005 0x00007ffff7f76b50 in ?? () 0000006 0x00007fffe65d0b90 in ?? () 0000007 0x00007ffff7f67a60 in ?? () 0000008 0x0000000000ac5cf8 in ?? () 0000009 0x00007fffe6ecd7f8 in ?? () 0000010 0x0000000000ac5d48 in ?? () 0000011 0x0000000000ac5d68 in ?? () 0000012 0x00007fffe672f518 in ?? () 0000013 0x00007fffe6ee6198 in ?? () 0000014 0x0000000000ac5d28 in ?? () 0000015 0x00007fffe672f518 in ?? () 0000016 0x00007fffe6ee61d8 in ?? () 0000017 0x0000000000000000 in ?? () (gdb) There is no gdk_pixbuf_save except for TUnityTrayIconHandle. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r55709 | ||||
LazTarget | - | ||||
Widgetset | GTK 2 | ||||
Attached Files |
|
|
Could you make a patch please. |
|
The unity tray icon needs to be saved to a file because the unity implementation assumes the icon is in your /usr/share/icons directory. There is no way to load the icon by memory. As a workaround (/usr/share/icons is owned by root), the unity devs allow you to load unity tray icons from a file, and that is what TUnityTrayIconHandle implementation does, it saves the icon to a file. Regarding gdk_pixbuf_save(), I just reused the declaration from the fpc packages folder, and I guess missed the varargs directive in the declaration "fpc/packages/gtk2/src/gtk+/gdk-pixbuf/gdk2pixbuf.pas". The final parameter of gdk_pixbuf_save() is C vararg. Please correct the source to add the appropriate extra argument(s) when gdk_pixbuf_save() is invoked. |
|
patch (1,102 bytes)
Index: lcl/interfaces/gtk2/unitywsctrls.pas =================================================================== --- lcl/interfaces/gtk2/unitywsctrls.pas (Revision 55664) +++ lcl/interfaces/gtk2/unitywsctrls.pas (Arbeitskopie) @@ -148,7 +148,7 @@ if FileExists(GlobalIconPath) then DeleteFile(GlobalIconPath); GlobalIconPath := IconThemePath + FIconName + '.' + IconType; - gdk_pixbuf_save(GlobalIcon, PChar(GlobalIconPath), IconType, nil); + gdk_pixbuf_save(GlobalIcon, PChar(GlobalIconPath), IconType, nil, [nil]); if GlobalAppIndicator <> nil then app_indicator_set_icon(GlobalAppIndicator, PChar(FIconName)); end @@ -184,7 +184,7 @@ if FileExists(GlobalIconPath) then DeleteFile(GlobalIconPath); GlobalIconPath := IconThemePath + FIconName + '.' + IconType; - gdk_pixbuf_save(GlobalIcon, PChar(GlobalIconPath), IconType, nil); + gdk_pixbuf_save(GlobalIcon, PChar(GlobalIconPath), IconType, nil, [nil]); { Again it seems that icons can only come from files } app_indicator_set_icon(GlobalAppIndicator, PChar(FIconName)); end; |
|
> Could you make a patch please. here, was [nil] after all >The unity tray icon needs to be saved to a file because the unity implementation assumes the icon is in your /usr/share/icons directory. I might have my icons in files. Lazarus could remember where they were loaded from in the first place. >it saves the icon to a file. Nowadays (with systemd), they recommend to use $XDG_RUNTIME_DIR aka /run/user/$uid for temporary files >Regarding gdk_pixbuf_save(), I just reused the declaration from the fpc packages folder, time for a fpc bug to remove the 4-arg version from there |
|
> I might have my icons in files. Lazarus could remember where they were loaded from in the first place. That's not how component resources work. The form designer streams images/icons as text and hex encoded data to a lfm resource embedded inside your executable. The there is no link between your original image file and the icon object TrayIcon1: TTrayIcon Icon.Data = { 50170200 .... Regarding temp files, on my system $XDG_RUNTIME is not defined, but /tmp exists on EVERY system. Extracted icon data should be placed in /tmp if they are to work with unity indicators. As a side note, unity indicators will be removed in future releases of ubuntu starting with 17.10. |
|
Applied, thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-08-10 19:34 | Benito van der Zander | New Issue | |
2017-08-15 08:56 | Juha Manninen | Note Added: 0102172 | |
2017-08-15 11:09 | Anthony Walter | Note Added: 0102179 | |
2017-08-15 11:12 | Anthony Walter | Note Edited: 0102179 | View Revisions |
2017-08-15 11:13 | Anthony Walter | Note Edited: 0102179 | View Revisions |
2017-08-15 11:13 | Anthony Walter | Note Edited: 0102179 | View Revisions |
2017-08-15 13:16 | Benito van der Zander | File Added: patch | |
2017-08-15 13:22 | Benito van der Zander | Note Added: 0102183 | |
2017-08-15 23:28 | Anthony Walter | Note Added: 0102193 | |
2017-08-15 23:28 | Anthony Walter | Note Edited: 0102193 | View Revisions |
2017-08-15 23:29 | Anthony Walter | Note Edited: 0102193 | View Revisions |
2017-08-15 23:30 | Anthony Walter | Note Edited: 0102193 | View Revisions |
2017-08-20 01:00 | Juha Manninen | Fixed in Revision | => r55709 |
2017-08-20 01:00 | Juha Manninen | LazTarget | => - |
2017-08-20 01:00 | Juha Manninen | Note Added: 0102245 | |
2017-08-20 01:00 | Juha Manninen | Status | new => resolved |
2017-08-20 01:00 | Juha Manninen | Resolution | open => fixed |
2017-08-20 01:00 | Juha Manninen | Assigned To | => Juha Manninen |