Version: unspecified (using Devel) OS: Linux Amarok fails to save the current playlist successfully on logout, whilst successfully saving it when it is manually Quit. The unsaved playlist is completely lost. Reproducible: Didn't try
commit d1536e41e8faddac3a07329744abba7b22d2dd74 branch master Author: Sergey Ivanov <123kash@gmail.com> Date: Sun Jan 2 20:42:55 2011 +0300 Make amarok save current playlist in case of forced application termination ( logout, Ctr+C in console, etc). BUG: 260349 diff --git a/src/main.cpp b/src/main.cpp index 2e1e43c..a1f64d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,12 +23,13 @@ #include <KCmdLineArgs> #include <KDebug> +#include <csignal> + //#define AMAROK_USE_DRKONQI extern AMAROK_EXPORT class KAboutData aboutData; //defined in App.cpp extern AMAROK_EXPORT class OcsData ocsData; - int main( int argc, char *argv[] ) { //Authors @@ -256,6 +257,12 @@ int main( int argc, char *argv[] ) return 0; } + // Rewrite default SIGINT and SIGTERM handlers + // to make amarok save current playlists during forced + // application termination (logout, Ctr+C in console etc.) + signal( SIGINT, &QCoreApplication::exit ); + signal( SIGTERM, &QCoreApplication::exit ); + App app; app.setUniqueInstance( startFlag == KUniqueApplication::NonUniqueInstance ); return app.exec();