! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Svg files cause thunar window to freeze
Status:
RESOLVED: FIXED

Comments

Description keith pattington 2007-02-16 15:41:30 CET
Svg files with embeded images created with inkscape cause the current thunar window to freeze for an amount of time relative to the size of the file. Does it even if display thumbnails is turned off in the preferences. Machine 1.6 core 2 2G of ram
Comment 1 keith pattington 2007-02-16 15:53:12 CET
Created attachment 1000 
An svg test file

An example svg test file that causes the problem.
Comment 2 Benedikt Meurer editbugs 2007-02-16 22:33:53 CET
That happens only if you select such a file, right?
Comment 3 keith pattington 2007-02-17 13:20:12 CET
(In reply to comment #2)
> That happens only if you select such a file, right?
> 

No, it happens when you browse into the directory were the file is located. You cannot select the file or do any other operation in this window until it unfreezes (10Meg file ~30 Sec).
Comment 4 Chris 2008-07-08 20:21:41 CEST
I am also running into this problem in 0.9.0.  Thunar does not freeze when I open the directory containing the SVG file(s), but does freeze when I select the file - either by mouseover (using single-click activation in thunar) or clicking (double-click activation).  Running dual 3.6GHz Xeon w/ 4GB RAM and still can have 10-30s of freeze time.  Images do not need to be embedded to cause this problem - even linked images will cause a freeze.
Comment 5 Hubert Hesse 2011-04-14 20:03:47 CEST
Created attachment 3610 
Call of the broken gdk function.

Replace with your prepared SVG.
Compile it. E.g. with
gcc file_info.c -o file_info `pkg-config --cflags --libs glib-2.0` `pkg-config --cflags --libs gdk-pixbuf-2.0`
Comment 6 Hubert Hesse 2011-04-14 20:07:07 CEST
The problem comes from a probably broken gdk function
gdk_pixbuf_get_file_info() in thunar-list-model.c

The enlightenment developers also came across that problem.
http://www.mail-archive.com/enlightenment-cvs@lists.sourceforge.net/msg07711.html

I would recommend to skip image size calculation and the the call gdk function for svgs for now. 

I'll investigate further possible solutions.
Comment 7 Hubert Hesse 2011-04-25 23:20:14 CEST
I reported the bug in gdk_pixbuf_get_file_info () here https://bugzilla.gnome.org/show_bug.cgi?id=647803.
Comment 8 Hubert Hesse 2011-04-25 23:34:57 CEST
Created attachment 3640 
Introducing an Adapter which stops the call of the broken gdk function for svg

Introduce an Adapter for gdk_pixbuf_get_file_info(). Since its broken for SVGs the adapter stops the call of the function for that type of files..
Comment 9 Hubert Hesse 2011-05-15 20:27:49 CEST
Created attachment 3675 
there can be null pointer in height and width from thunar_file_get_image_size

This fixes the segfault through an empty svg.
Comment 10 Hubert Hesse 2011-05-18 23:28:47 CEST
Created attachment 3679 
Use libmagic for preventing gdk_pixbuf svg bug

Due to limited knowledge of automake. I had to add LIBS = -lmagic to the generated  Makefile in thunar/thunar. If there is the wish I will look further into this.
Comment 11 Hubert Hesse 2011-05-31 14:33:45 CEST
Created attachment 3705 
Use libmagic for preventing gdk_pixbuf svg bug. Link via autotools

Introduce --with-magic for checking the type of a file via libmagic. (Disabled by default)
Comment 12 Hubert Hesse 2011-05-31 15:14:49 CEST
Summary
Problem:
1.Select a svg files with embeded images cause thunar window to freeze.
Freeze time is proportional to the size of the file.
2.Svg files with an invalid size, e.g empty svg, cause thunar to crash.

Discussion:
The problem origins from a broken gdk function
gdk_pixbuf_get_file_info() in thunar-list-model.c
and was reported before in Enlightenment in 2004 [1].
They assumed a static size of 64x64px for every svg,
which is sufficient for SVG icons.

I suggest to skip the computation of the size for svg files entirely.
The first patch: attachment 3675  introduces an adapter which does that identifying
the type of the file using thunar's functions.
This adapter also checks if the returned width && height is valid to solve the second problem.

However the first doesn't work if the svg is hidden behind a wrong extension, because this
is how the thunar function determine the type of a file. The second patch: attachment 3705 , which builds upon the first one,
solves this using libmagic instead.


[1] http://www.mail-archive.com/enlightenment-cvs@lists.sourceforge.net/msg07711.html

The Bug report from gdk-pixbuf is located here:
https://bugzilla.gnome.org/show_bug.cgi?id=647803.
Comment 13 Hubert Hesse 2011-06-06 21:29:05 CEST
For convenience I pushed my fix here:
https://github.com/hubx/thunar/branches/bug2913

I reverted attachment 3675  to attachment 3640  there, because width & height are no pointers in this situation. As a consequence it can't trigger a segfault.
Although one could discuss if zero size have to appear in the status text.
Comment 14 Hubert Hesse 2011-08-31 13:38:50 CEST
Any chance this will be merged soon?
Comment 15 Nick Schermer editbugs 2012-09-28 21:08:04 CEST
*** Bug 7892 has been marked as a duplicate of this bug. ***
Comment 16 Nick Schermer editbugs 2012-09-28 21:10:56 CEST
Fixed (or: workaround) in d9129c8.

Bug #2913

Reported by:
keith pattington
Reported on: 2007-02-16
Last modified on: 2012-09-28
Duplicates (1):
  • 7892 segfault when a specific html file is selected

People

Assignee:
Jannis Pohlmann
CC List:
5 users

Version

Attachments

An svg test file ( deleted )
2007-02-16 15:49 CET , keith pattington
no flags
An svg test file ( deleted )
2007-02-16 15:50 CET , keith pattington
no flags
An svg test file (44 bytes, text/plain)
2007-02-16 15:53 CET , keith pattington
no flags
Call of the broken gdk function. (187 bytes, application/octet-stream)
2011-04-14 20:03 CEST , Hubert Hesse
no flags
Introducing an Adapter which stops the call of the broken gdk function for svg (3.28 KB, patch)
2011-04-25 23:34 CEST , Hubert Hesse
no flags
there can be null pointer in height and width from thunar_file_get_image_size (3.58 KB, patch)
2011-05-15 20:27 CEST , Hubert Hesse
no flags
Use libmagic for preventing gdk_pixbuf svg bug (2.67 KB, patch)
2011-05-18 23:28 CEST , Hubert Hesse
no flags
Use libmagic for preventing gdk_pixbuf svg bug. Link via autotools (4.45 KB, patch)
2011-05-31 14:33 CEST , Hubert Hesse
no flags

Additional information