Bug 287474 - kfilemetadatareader crashes on any file
Summary: kfilemetadatareader crashes on any file
Status: RESOLVED FIXED
Alias: None
Product: kde
Classification: Unclassified
Component: general (show other bugs)
Version: Git
Platform: Compiled Sources Microsoft Windows
: NOR crash (vote)
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-24 16:53 UTC by Patrick Spendrin
Modified: 2011-11-25 14:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.4


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Spendrin 2011-11-24 16:53:30 UTC
Version:           unspecified (using KDE 4.7.3) 
OS:                MS Windows

kfilemetadatareader crashes in dolphin when hovering over any file (after having enabled the information menu).
instead, you can also call kfilemetadatareader directly with a file URL.

Reproducible: Always

Steps to Reproduce:
run 
kfilemetadatareader file:///C:/Windows/System32/kernel32.dll

Actual Results:  
it crashes.

Expected Results:  
it should return some unreadable noise

backtrace in the next comment.
Comment 1 Patrick Spendrin 2011-11-24 17:04:50 UTC
I redirected this bug to the KDE component.

Backtrace:
QtCore4!QEventDispatcherWin32::registerEventNotifier+0x24
QtCore4!QWinEventNotifier::QWinEventNotifier+0x76
QtNetwork4!QLocalSocketPrivate::init+0x84
QtNetwork4!QLocalSocket::QLocalSocket+0x7f
sopranoclient!Soprano::Client::LocalSocketClientConnection::newConnection+0x124
sopranoclient!Soprano::Client::ClientConnection::socketForCurrentThread+0x6c
sopranoclient!Soprano::Client::ClientConnection::connectInCurrentThread+0x5
sopranoclient!Soprano::Client::LocalSocketClient::connect+0x7b
nepomuk!`anonymous namespace'::GlobalModelContainer::init+0x21f
nepomuk!Nepomuk::MainModel::init+0x16
nepomuk!Nepomuk::MainModel::MainModel+0x6e
nepomuk!Nepomuk::ResourceManager::init+0x66
nepomuk!Nepomuk::ResourceManager::ResourceManager+0x2b7
nepomuk!Nepomuk::ResourceManager::instance+0x9f
nepomuk!Nepomuk::Resource::Resource+0x30
kfilemetadatareader!readFileAndContextMetaData+0x128
kfilemetadatareader!main+0x5c7
kfilemetadatareader!WinMain+0x105
kfilemetadatareader!__tmainCRTStartup+0x150
kernel32!BaseThreadInitThunk+0xe

This backtrace doesn't say a lot, just in Nepomuk::ResourceManager::instance() the instance is reparented to QCoreApplication::instance() which is 0x0 at that point.
Adding a QCoreApplication app(argc, argv); into kio/kfile/kfilemetadatareaderprocess.cpp:main seems to fix that crash.
Since I have no idea if that might be a correct fix, maybe you could say something about this?
Comment 2 Peter Penz 2011-11-24 20:42:21 UTC
@Patrick: Thanks for pointing this out. I'm surprised that I obviously forgot to add a QCoreApplication there already. Running Qt-stuff without at least a QCoreApplication is a no-go (even if no events are used) - please just go ahead and add this one-liner to main.cpp (or give me a hint if I should double-check this and push the patch myself).
Comment 3 Peter Penz 2011-11-25 14:18:02 UTC
Git commit e4118bc344856490dffe3cd9ef357a855de6b6a1 by Peter Penz.
Committed on 25/11/2011 at 15:13.
Pushed by ppenz into branch 'KDE/4.7'.

KFileMetaDataReaderProcess: Use a QCoreApplication

Thanks to Patrick Spendrin for the hint. Strange that without the
patch this did result in a crash only with MS Windows and not
with Linux...

BUG: 287474
FIXED-IN: 4.7.4

M  +56   -20   kio/kfile/kfilemetadatareaderprocess.cpp

http://commits.kde.org/kdelibs/e4118bc344856490dffe3cd9ef357a855de6b6a1