From 1108b934840c416832af0367b9247e63041fe869 Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Sun, 14 Jul 2013 08:11:47 +0000
Subject: we remove events only when shutdown is irreversible

git-svn-id: http://svn.miranda-ng.org/main/trunk@5356 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/AVS/src/main.cpp | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

(limited to 'plugins')

diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp
index 3f03247a9a..7a54b884ef 100644
--- a/plugins/AVS/src/main.cpp
+++ b/plugins/AVS/src/main.cpp
@@ -2105,21 +2105,17 @@ static int OptInit(WPARAM wParam, LPARAM lParam)
 
 static int OkToExitProc(WPARAM wParam, LPARAM lParam)
 {
-	EnterCriticalSection(&cachecs);
 	g_shutDown = TRUE;
-
-	DestroyHookableEvent(hEventChanged); hEventChanged = 0;
-	DestroyHookableEvent(hEventContactAvatarChanged); hEventContactAvatarChanged = 0;
-	DestroyHookableEvent(hMyAvatarChanged); hMyAvatarChanged = 0;
-
-	LeaveCriticalSection(&cachecs);
-
 	SetEvent(hLoaderEvent);
 	return 0;
 }
 
 static int ShutdownProc(WPARAM wParam, LPARAM lParam)
 {
+	DestroyHookableEvent(hEventChanged); hEventChanged = 0;
+	DestroyHookableEvent(hEventContactAvatarChanged); hEventContactAvatarChanged = 0;
+	DestroyHookableEvent(hMyAvatarChanged); hMyAvatarChanged = 0;
+
 	DeleteCriticalSection(&cachecs);
 	DeleteCriticalSection(&alloccs);
 	return 0;
-- 
cgit v1.2.3