im.pidgin.pidgin: 60eada187e99c03a7287cb9f6fc240a6d9235253

datallah at pidgin.im datallah at pidgin.im
Thu Jan 3 20:45:38 EST 2008


-----------------------------------------------------------------
Revision: 60eada187e99c03a7287cb9f6fc240a6d9235253
Ancestor: d6a61199b689a66c0e7f970021e7d5f79b1b0a37
Author: datallah at pidgin.im
Date: 2008-01-04T01:10:09
Branch: im.pidgin.pidgin

Modified files:
        pidgin/win32/winpidgin.c

ChangeLog: 

This is how the error handling for the win32 single instance mutex is supposed to work.

-------------- next part --------------
============================================================
--- pidgin/win32/winpidgin.c	cde0b0d4083f0b6124579b5b13319b897ac9bd66
+++ pidgin/win32/winpidgin.c	cb1f32475c317e48999faf40a8aec80869f253b5
@@ -450,23 +450,25 @@ static BOOL winpidgin_set_running(BOOL f
 
 	if ((h = CreateMutex(NULL, FALSE, "pidgin_is_running"))) {
 		DWORD err = GetLastError();
-		if (err == ERROR_ALREADY_EXISTS && fail_if_running) {
-			HWND msg_win;
+		if (err == ERROR_ALREADY_EXISTS) {
+			if (fail_if_running) {
+				HWND msg_win;
 
-			printf("An instance of Pidgin is already running.\n");
+				printf("An instance of Pidgin is already running.\n");
 
-			if((msg_win = FindWindowEx(HWND_MESSAGE, NULL, TEXT("WinpidginMsgWinCls"), NULL)))
-				if(SendMessage(msg_win, PIDGIN_WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL))
-					return FALSE;
+				if((msg_win = FindWindowEx(HWND_MESSAGE, NULL, TEXT("WinpidginMsgWinCls"), NULL)))
+					if(SendMessage(msg_win, PIDGIN_WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL))
+						return FALSE;
 
-			/* If we get here, the focus request wasn't successful */
+				/* If we get here, the focus request wasn't successful */
 
-			MessageBox(NULL,
-				"An instance of Pidgin is already running",
-				NULL, MB_OK | MB_TOPMOST);
+				MessageBox(NULL,
+					"An instance of Pidgin is already running",
+					NULL, MB_OK | MB_TOPMOST);
 
-			return FALSE;
-		} else
+				return FALSE;
+			}
+		} else if (err != ERROR_SUCCESS)
 			printf("Error (%u) accessing \"pidgin_is_running\" mutex.\n", (UINT) err);
 	}
 	return TRUE;


More information about the Commits mailing list