Bug 115825 - Crash when attempting preview of PHP file
Summary: Crash when attempting preview of PHP file
Status: RESOLVED DUPLICATE of bug 111115
Alias: None
Product: kfile-plugins
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-06 22:50 UTC by Kevin Krammer
Modified: 2005-11-11 17:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
File used to trigger crash (19 bytes, text/plain)
2005-11-06 22:52 UTC, Kevin Krammer
Details
A backtrace (5.39 KB, text/plain)
2005-11-06 22:53 UTC, Kevin Krammer
Details
Another backtrace (7.18 KB, text/plain)
2005-11-06 22:54 UTC, Kevin Krammer
Details
stderr of kdialog during second test run (7.16 KB, text/plain)
2005-11-06 22:58 UTC, Kevin Krammer
Details
Backtrace of 3.4.2 (6.85 KB, text/plain)
2005-11-07 01:06 UTC, Kevin Krammer
Details
Possible improvement (1.05 KB, patch)
2005-11-08 14:03 UTC, Kevin Krammer
Details
Improved patch (1.38 KB, patch)
2005-11-08 19:19 UTC, Kevin Krammer
Details
Associated improvement for PreviewJob (1.82 KB, patch)
2005-11-09 13:48 UTC, Kevin Krammer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Krammer 2005-11-06 22:50:55 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          g++ (GCC) 4.0.3 20051023 (prerelease) (Debian 4.0.2-3) Debian SID
OS:                Linux

Using SVN Revision: 478432

Applications crash when attempting to display a preview in the file dialog's preview pane for PHP files. Backtraces and output will follow shortly.

The problem seems to have two parts:
- the audiopreview plugin is selected to create the preview for a PHP file
- the plugin crashed when accessing the file it isn't designed for to handle

Reproduced with
kdialog --getopenfilename $(pwd)
and then changing to /tmp where I had the test file.
Then either selecting the file with the preview pane visible or making it visible while the file being selected (backtrack1 and backtrace2 respectively)
Comment 1 Kevin Krammer 2005-11-06 22:52:43 UTC
Created attachment 13310 [details]
File used to trigger crash
Comment 2 Kevin Krammer 2005-11-06 22:53:57 UTC
Created attachment 13311 [details]
A backtrace

Backtrace of kdialog --getopenfilename when enabling the preview pane and then
clicking on the test.php file
Comment 3 Kevin Krammer 2005-11-06 22:54:55 UTC
Created attachment 13312 [details]
Another backtrace

Backtrace generated from kdialog --getopenfilename when activating the preview
pane while the test.php is selected
Comment 4 Kevin Krammer 2005-11-06 22:58:20 UTC
Created attachment 13313 [details]
stderr of kdialog during second test run

The stderr of kdialog --getopenfilename during the second test run (see
backtrace2)

Most kdebug areas are enabled
stdout file was empty.

The following lines were written to the Konsole window:
DCOP: register 'kdialog-4073' -> number of clients is now 1
kio_file: ========= LIST file:///home/kdedev =========
kio_file: ============= COMPLETED LIST ============
kio_file: ========= LIST file:///tmp =========
kio_file: ============= COMPLETED LIST ============
DCOP: unregister 'kdialog-4073'
DCOP: register 'anonymous-4077' -> number of clients is now 1
DCOP:  'anonymous-4077' now known as 'drkonqi-4077'
kio_file: ========= LIST file:///home/kdedev =========
kio_file: ============= COMPLETED LIST ============
kio_file: ========= LIST file:///tmp =========
kio_file: ============= COMPLETED LIST ============
kio_file: FileProtocol::stat details=2
Comment 5 Thiago Macieira 2005-11-06 23:56:00 UTC
Both of your backtraces point to the gcc bug in libstdc++.

Use GLIBCXX_FORCE_NEW=1 and complain to your distribution.

*** This bug has been marked as a duplicate of 111115 ***
Comment 6 Kevin Krammer 2005-11-07 00:21:16 UTC
The crash also happens with binary 3.4.2 packages which are not using the visibility patch.

Moreover the problem part which results in the audiopreview plugin being selected for PHP files is still open, isn't it?
Comment 7 Thiago Macieira 2005-11-07 00:40:59 UTC
If it happens, it would be a different bug. Both backtraces you pasted show a crash inside libstdc++'s pool allocator, which is the root cause of Bug 111115. If you can provide other backtraces, we will analyse.
Comment 8 Kevin Krammer 2005-11-07 01:06:57 UTC
Created attachment 13315 [details]
Backtrace of 3.4.2

This is the backtrace of the Debian SID 3.4.2 packages.

To my knowledge the are compiled without visibility support as it causes
problems on some platforms.

However the crash could of course still be something Debian or compiler
specific, but something else seems to be wrong if the audio plugin is getting
the request for the PHP preview
Comment 9 Kevin Krammer 2005-11-07 01:15:37 UTC
export GLIBCXX_FORCE_NEW=1

Solves the problem with the crash.

Still loads the audio preview though.
How about reopening it with severity "minor" for this second issue?
Maybe a problem of the MIME type handling, PHP is application/x-php (according to kfile), but has the Property::X-KDE-text with value true

Comment 10 Thiago Macieira 2005-11-07 01:23:42 UTC
Your third backtrace shows the same problem.

I did not understand your second issue.
Comment 11 Kevin Krammer 2005-11-07 11:26:59 UTC
> Your third backtrace shows the same problem.

Yeah, thought so.
I will check the Debian bug tracking system then. Must be something else than -fvisibility that causes this as well, the KDE packagers posted a lengthy email why they won't enable it before KDE4

> I did not understand your second issue.

Assuming that the preview works on MIME types it is kind of wrong to ask the audio plugin for a preview of PHP script files, I would have expected that the one for text files is used.
Comment 12 David Faure 2005-11-07 23:46:28 UTC
On Monday 07 November 2005 00:21, Kevin Krammer wrote:
> Moreover the problem part which results in the audiopreview plugin being selected for PHP files is still open, isn't it?


The code (from kio/kfile/kfilemetapreview.cpp) says

    if ( s_tryAudioPreview &&
         !mimeType.startsWith("text/") && !mimeType.startsWith("image/") )
    {
        if ( !haveAudioPreview )
        {
            KPreviewWidgetBase *audioPreview = createAudioPreview( m_stack );
            if ( audioPreview )
            {
                haveAudioPreview = true;
                (void) m_stack->addWidget( audioPreview );
                QStringList mimeTypes = audioPreview->supportedMimeTypes();
                QStringList::ConstIterator it = mimeTypes.begin();
                for ( ; it != mimeTypes.end(); ++it )
                    m_previewProviders.insert( *it, audioPreview );
            }
        }
    }

i.e. it creates an audiopreview object simply to be able to ask it "which mimetypes do you support".
I have no idea if this could be done better - cc'ing Carsten in case he has time to have a look.
Comment 13 Kevin Krammer 2005-11-08 14:03:59 UTC
Created attachment 13334 [details]
Possible improvement

I tried to use the KMimeType class to improve the handling of still unknown
types.

It seems to work until requesting the preview for "text/plain" because while it
gets there ti still doesn't show a text preview.
I also tried "text/*", no difference
Comment 14 David Faure 2005-11-08 15:18:48 UTC
On Tuesday 08 November 2005 14:04, Kevin Krammer wrote:
> I tried to use the KMimeType class to improve the handling of still unknown
> types.


You should probably iterate over the "parent mimetype" chain, since inheritance is
possible on multiple levels. No idea about the problem you mention though.
Comment 15 Carsten Pfeiffer 2005-11-08 17:27:06 UTC
On Monday 07 November 2005 23:46, David Faure wrote:

> i.e. it creates an audiopreview object simply to be able to ask it "which
> mimetypes do you support". I have no idea if this could be done better -
> cc'ing Carsten in case he has time to have a look.


At that time, it couldn't be done any better :-( 

aRts knows the list of mimetypes it supports (through all those playObject 
plugins), so we have to instantiate some aRts class and ask it. No way around 
that.

Better would be if that information could be fetched separately, without 
loading libarts.so

Cheers
Carsten
Comment 16 Kevin Krammer 2005-11-08 19:19:30 UTC
Created attachment 13346 [details]
Improved patch

Now iterates over over the inheritance list.

It actually finds a provider when doing the text/* lookup after reading the
KDE-text property, so previewProviderFor() now also works for application/x-php


Unfortunately it doesn't result in a preview.

I will try to continue investigation tomorrow.
Comment 17 Kevin Krammer 2005-11-09 13:48:32 UTC
Created attachment 13359 [details]
Associated improvement for PreviewJob

KIO::PreviewJob also needs to check MIME Type inheritance and KDE-text property
as a fallback when there is no preview for a file's MIME Type itself
Comment 18 David Faure 2005-11-11 15:51:57 UTC
Looks good, feel free to commit if it works for you.
Comment 19 Kevin Krammer 2005-11-11 17:18:29 UTC
Thanks, comitted in 3.5 branch:
http://lists.kde.org/?l=kde-commits&m=113172381908573&w=2