Summary: | Crash when LibLastfm throws exceptions | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Jochen Bauer <skywalker_99> |
Component: | general | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | andresbajotierra, kuba.serafinowski, lfranchi, modax, valorie.zimmerman |
Priority: | VHI | Keywords: | release_blocker |
Version: | 2.3-GIT | ||
Target Milestone: | 2.2.2 | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Jochen Bauer
2009-10-27 22:22:07 UTC
- Is your build updated? This looks like bug 200546 , which was fixed some days ago... Thanks My build was from yesterday evening. Just did a completely clean build and trying again. After a full clean rebuild with deleting all am,arok folders, the thing doesnt happen anymore. commit 06fe035e58d190706e949bcd8fa270f6311c107f Author: Mark Kretschmann <kretschmann@kde.org> Date: Sun Nov 1 12:17:00 2009 +0100 Enable C++ exceptions handling in Amarok. Fixes liblastfm crashes. Liblastfm is using exceptions for error handling. Since Amarok (like all KDE apps by default) was built without exceptions support, we just _crashed_ whenever an exception occured. Fixed. Additional bonus: We could use exceptions in Amarok itself now, if there is a need. BUG: 200546 BUG: 212115 Reopening, as we are still experiencing issues. For reference: "Qt has caught an exception thrown from an event handler. Throwing exceptions from an event handler is not supported in Qt. You must reimplement QApplication::notify() and catch all exceptions there. terminate called after throwing an instance of 'lastfm::ws::Error'" *** Bug 200546 has been marked as a duplicate of this bug. *** Also for reference: http://pastebin.com/m40fda813 I've just found an interesting blog article that could help us with debugging this: http://agateau.wordpress.com/2009/12/22/tip-of-the-day-finding-the-source-of-a-bad_alloc-exception/ commit ca312861bac8be336623c04fd9cd9f164b452ba2 Author: Mark Kretschmann <kretschmann@kde.org> Date: Fri Dec 25 08:03:30 2009 +0100 Try to fix Qt crashes when Liblastfm throws exceptions. According to Qt docs, the only way to do this is by overloading QCoreApplication::notify(). So we're doing that now. I don't know if it works, please give it some testing :) BUG: 212115 diff --git a/src/App.cpp b/src/App.cpp index 63943a6..3569ebe 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -809,7 +809,6 @@ void App::quit() bool App::event( QEvent *event ) { - switch( event->type() ) { //allows Amarok to open files from the finder on OS X @@ -836,6 +835,22 @@ bool App::event( QEvent *event ) } } +bool App::notify( QObject *receiver, QEvent *event ) +{ + // Here we try to catch exceptions from LiblastFm, which Qt can't handle, except in this method. + // @see: https://bugs.kde.org/show_bug.cgi?id=212115 + + try + { + return QApplication::notify( receiver, event ); + } + catch(...) + { + error() << "Caught an exception, probably from LibLastfm. Ignoring."; + } +} + + namespace Amarok { /// @see Amarok.h diff --git a/src/App.h b/src/App.h index 1c31537..ba313fc 100644 --- a/src/App.h +++ b/src/App.h @@ -89,7 +89,8 @@ class AMAROK_EXPORT App : public KUniqueApplication void quit(); protected: - bool event( QEvent *event ); + virtual bool event( QEvent *event ); + virtual bool notify( QObject *receiver, QEvent *event ); private slots: void slotTrashResult( KJob *job ); commit ca312861bac8be336623c04fd9cd9f164b452ba2 Author: Mark Kretschmann <kretschmann@kde.org> Date: Fri Dec 25 08:03:30 2009 +0100 Try to fix Qt crashes when Liblastfm throws exceptions. According to Qt docs, the only way to do this is by overloading QCoreApplication::notify(). So we're doing that now. I don't know if it works, please give it some testing :) BUG: 212115 diff --git a/src/App.cpp b/src/App.cpp index 63943a6..3569ebe 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -809,7 +809,6 @@ void App::quit() bool App::event( QEvent *event ) { - switch( event->type() ) { //allows Amarok to open files from the finder on OS X @@ -836,6 +835,22 @@ bool App::event( QEvent *event ) } } +bool App::notify( QObject *receiver, QEvent *event ) +{ + // Here we try to catch exceptions from LiblastFm, which Qt can't handle, except in this method. + // @see: https://bugs.kde.org/show_bug.cgi?id=212115 + + try + { + return QApplication::notify( receiver, event ); + } + catch(...) + { + error() << "Caught an exception, probably from LibLastfm. Ignoring."; + } +} + + namespace Amarok { /// @see Amarok.h diff --git a/src/App.h b/src/App.h index 1c31537..ba313fc 100644 --- a/src/App.h +++ b/src/App.h @@ -89,7 +89,8 @@ class AMAROK_EXPORT App : public KUniqueApplication void quit(); protected: - bool event( QEvent *event ); + virtual bool event( QEvent *event ); + virtual bool notify( QObject *receiver, QEvent *event ); private slots: void slotTrashResult( KJob *job ); Hm, the crash is still in Amarok 2.2.2, apparently, see the following duplicate *** Bug 225799 has been marked as a duplicate of this bug. *** the marked duplicate crash is different, so marking as resolved fixed still. |