[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.2/kdepim/kalarm
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2009-06-21 17:10:12
Message-ID: 1245604212.007395.2874.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 984903 by djarvie:

Fix crash creating alarm from command line, if KAlarm not already running.


 M  +2 -1      Changelog  
 M  +16 -8     kalarmapp.cpp  
 M  +2 -2      kalarmapp.h  


--- branches/KDE/4.2/kdepim/kalarm/Changelog #984902:984903
@@ -1,9 +1,10 @@
 KAlarm Change Log
 
-=== Version 2.1.9 --- 14 June 2009 ===
+=== Version 2.1.9 --- 21 June 2009 ===
 - Fix email alarms sending multiple mails, when sent via KMail.
 - Fix crash when closing remote calendars.
 - Fix crash when more than one alarm with audio is displayed simultaneously.
+- Fix crash creating alarm from command line, if KAlarm not already running.
 
 === Version 2.1.8 (KDE 4.2.4) --- 25 May 2009 ===
 - Fix crash on exit from birthday import dialogue.
--- branches/KDE/4.2/kdepim/kalarm/kalarmapp.cpp #984902:984903
@@ -767,8 +767,9 @@
 
 /******************************************************************************
 * Quit the program, optionally only if there are no more "instances" running.
+* Reply = true if program exited.
 */
-void KAlarmApp::quitIf(int exitCode, bool force)
+bool KAlarmApp::quitIf(int exitCode, bool force)
 {
 	if (force)
 	{
@@ -777,42 +778,46 @@
 		MainWindow::closeAll();
 		displayTrayIcon(false);
 		if (MessageWin::instanceCount())
-			return;
+			return false;
 	}
 	else if (mQuitting)
-		return;   // MainWindow::closeAll() causes quitIf() to be called again
+		return false;   // MainWindow::closeAll() causes quitIf() to be called again
 	else
 	{
 		// Quit only if there are no more "instances" running
 		mPendingQuit = false;
 		if (mActiveCount > 0  ||  MessageWin::instanceCount())
-			return;
+			return false;
 		int mwcount = MainWindow::count();
 		MainWindow* mw = mwcount ? MainWindow::firstWindow() : 0;
 		if (mwcount > 1  ||  (mwcount && (!mw->isHidden() || !mw->isTrayParent())))
-			return;
+			return false;
 		// There are no windows left except perhaps a main window which is a hidden tray icon parent
 		if (mTrayWindow)
 		{
 			// There is a system tray icon.
 			// Don't exit unless the system tray doesn't seem to exist.
 			if (checkSystemTray())
-				return;
+				return false;
 		}
 		if (!mDcopQueue.isEmpty()  ||  !mCommandProcesses.isEmpty())
 		{
 			// Don't quit yet if there are outstanding actions on the execution queue
 			mPendingQuit = true;
 			mPendingQuitCode = exitCode;
-			return;
+			return false;
 		}
 	}
 
 	// This was the last/only running "instance" of the program, so exit completely.
 	kDebug() << exitCode << ": quitting";
+	delete mAlarmTimer;     // prevent checking for alarms after deleting calendars
+	mAlarmTimer = 0;
+	mInitialised = false;   // prevent processQueue() from running
 	AlarmCalendar::terminateCalendars();
 	BirthdayModel::close();
 	exit(exitCode);
+	return true;    // sometimes we actually get to here, despite calling exit()
 }
 
 /******************************************************************************
@@ -1018,7 +1023,10 @@
 
 		// Now that the queue has been processed, quit if a quit was queued
 		if (mPendingQuit)
-			quitIf(mPendingQuitCode);
+		{
+			if (quitIf(mPendingQuitCode))
+				return;  // quitIf() can sometimes return, despite calling exit()
+		}
 
 		mProcessingQueue = false;
 
--- branches/KDE/4.2/kdepim/kalarm/kalarmapp.h #984902:984903
@@ -56,7 +56,7 @@
 		bool               korganizerEnabled() const       { return mKOrganizerEnabled; }
 		bool               restoreSession();
 		bool               sessionClosingDown() const      { return mSessionClosingDown; }
-		void               quitIf()                        { quitIf(0); }
+		bool               quitIf()                        { return quitIf(0); }
 		void               doQuit(QWidget* parent);
 		static void        displayFatalError(const QString& message);
 		void               addWindow(TrayWindow* w)        { mTrayWindow = w; }
@@ -147,7 +147,7 @@
 		};
 
 		bool               initCheck(bool calendarOnly = false);
-		void               quitIf(int exitCode, bool force = false);
+		bool               quitIf(int exitCode, bool force = false);
 		bool               checkSystemTray();
 		void               startProcessQueue();
 		void               queueAlarmId(const QString& id);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic