diff options
author | George Hazan <ghazan@miranda.im> | 2017-10-10 13:38:28 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-10-10 13:38:28 +0300 |
commit | f6b9225bf5ccba811d7a24faf2e298361ed76649 (patch) | |
tree | 2637a330121f4f09a87c55030ecf6cbe430cc854 | |
parent | d01fbfbee39925d79512b8b829824cffc6d0698d (diff) |
fixes #968 (Crash on Listening dynamic unload)
-rw-r--r-- | plugins/ListeningTo/src/listeningto.cpp | 2 | ||||
-rw-r--r-- | plugins/ListeningTo/src/options.cpp | 11 | ||||
-rw-r--r-- | plugins/ListeningTo/src/options.h | 4 | ||||
-rw-r--r-- | plugins/ListeningTo/src/players/generic.cpp | 18 | ||||
-rw-r--r-- | plugins/ListeningTo/src/players/wmp.cpp | 35 | ||||
-rw-r--r-- | plugins/ListeningTo/src/version.h | 14 |
6 files changed, 25 insertions, 59 deletions
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index b8daa9b2f1..8ec11cec68 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -329,8 +329,6 @@ int PreShutdown(WPARAM, LPARAM) hTimer = NULL;
}
- DeInitOptions();
-
DestroyHookableEvent(hEnableStateChangedEvent);
DestroyHookableEvent(hListeningInfoChangedEvent);
diff --git a/plugins/ListeningTo/src/options.cpp b/plugins/ListeningTo/src/options.cpp index d29f64cf2f..9bc51bd3ab 100644 --- a/plugins/ListeningTo/src/options.cpp +++ b/plugins/ListeningTo/src/options.cpp @@ -21,15 +21,11 @@ Boston, MA 02111-1307, USA. // Prototypes /////////////////////////////////////////////////////////////////////////////////////
-HANDLE hOptHook = NULL;
-
Options opts;
extern std::vector<ProtocolInfo> proto_items;
extern HANDLE hExtraIcon;
-BOOL ListeningToEnabled(char *proto, BOOL ignoreGlobal = FALSE);
-
static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK PlayersDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK FormatDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -110,12 +106,7 @@ void InitOptions() LoadOptions();
- hOptHook = HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
-}
-
-void DeInitOptions()
-{
- UnhookEvent(hOptHook);
+ HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
}
void LoadOptions()
diff --git a/plugins/ListeningTo/src/options.h b/plugins/ListeningTo/src/options.h index 002237cf17..27c00fde77 100644 --- a/plugins/ListeningTo/src/options.h +++ b/plugins/ListeningTo/src/options.h @@ -72,10 +72,6 @@ extern Options opts; // Initializations needed by options
void InitOptions();
-// Deinitializations needed by options
-void DeInitOptions();
-
-
// Loads the options from DB
// It don't need to be called, except in some rare cases
void LoadOptions();
diff --git a/plugins/ListeningTo/src/players/generic.cpp b/plugins/ListeningTo/src/players/generic.cpp index e6a7a77c7b..db11f757d7 100644 --- a/plugins/ListeningTo/src/players/generic.cpp +++ b/plugins/ListeningTo/src/players/generic.cpp @@ -1,4 +1,4 @@ -/*
+/*
Copyright (C) 2005-2009 Ricardo Pescuma Domenecci
This is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "../stdafx.h"
@@ -55,10 +55,6 @@ static LRESULT CALLBACK ReceiverWndProc(HWND hWnd, UINT message, WPARAM wParam, }
break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
@@ -73,19 +69,15 @@ GenericPlayer::GenericPlayer() received[0] = L'\0';
singleton = this;
- WNDCLASS wc = { 0 };
+ WNDCLASS wc = {};
wc.lpfnWndProc = ReceiverWndProc;
wc.hInstance = hInst;
wc.lpszClassName = MIRANDA_WINDOWCLASS;
-
RegisterClass(&wc);
- hWnd = CreateWindow(MIRANDA_WINDOWCLASS, LPGENW("Miranda ListeningTo receiver"),
- 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
+ hWnd = CreateWindow(MIRANDA_WINDOWCLASS, LPGENW("Miranda ListeningTo receiver"), 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
}
-
-
GenericPlayer::~GenericPlayer()
{
if (hTimer != NULL) {
@@ -100,8 +92,6 @@ GenericPlayer::~GenericPlayer() singleton = NULL;
}
-
-
void GenericPlayer::ProcessReceived()
{
mir_cslockfull lck(cs);
diff --git a/plugins/ListeningTo/src/players/wmp.cpp b/plugins/ListeningTo/src/players/wmp.cpp index f7d2ab6df2..a78f6f3a57 100644 --- a/plugins/ListeningTo/src/players/wmp.cpp +++ b/plugins/ListeningTo/src/players/wmp.cpp @@ -33,15 +33,13 @@ WindowsMediaPlayer::WindowsMediaPlayer() received[0] = '\0';
singleton = this;
- WNDCLASS wc = { 0 };
+ WNDCLASS wc = {};
wc.lpfnWndProc = ReceiverWndProc;
wc.hInstance = hInst;
wc.lpszClassName = WMP_WINDOWCLASS;
-
RegisterClass(&wc);
- hWnd = CreateWindow(WMP_WINDOWCLASS, LPGENW("Miranda ListeningTo WMP receiver"),
- 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
+ hWnd = CreateWindow(WMP_WINDOWCLASS, LPGENW("Miranda ListeningTo WMP receiver"), 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
}
WindowsMediaPlayer::~WindowsMediaPlayer()
@@ -142,28 +140,21 @@ void WindowsMediaPlayer::NewData(const WCHAR *data, size_t len) static LRESULT CALLBACK ReceiverWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message) {
- case WM_COPYDATA:
- {
- if (!loaded)
- return FALSE;
-
- if (singleton == NULL || !singleton->enabled)
- return FALSE;
+ if (message == WM_COPYDATA) {
+ if (!loaded)
+ return FALSE;
- COPYDATASTRUCT* pData = (PCOPYDATASTRUCT)lParam;
- if (pData->dwData != 0x547 || pData->cbData == 0 || pData->lpData == NULL)
- return FALSE;
+ if (singleton == NULL || !singleton->enabled)
+ return FALSE;
- if (singleton != NULL)
- singleton->NewData((WCHAR *)pData->lpData, pData->cbData / 2);
+ COPYDATASTRUCT* pData = (PCOPYDATASTRUCT)lParam;
+ if (pData->dwData != 0x547 || pData->cbData == 0 || pData->lpData == NULL)
+ return FALSE;
- return TRUE;
- }
+ if (singleton != NULL)
+ singleton->NewData((WCHAR *)pData->lpData, pData->cbData / 2);
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
+ return TRUE;
}
return DefWindowProc(hWnd, message, wParam, lParam);
diff --git a/plugins/ListeningTo/src/version.h b/plugins/ListeningTo/src/version.h index 84b2995228..20920e804c 100644 --- a/plugins/ListeningTo/src/version.h +++ b/plugins/ListeningTo/src/version.h @@ -1,14 +1,14 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 3 +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 4 #define __RELEASE_NUM 0 -#define __BUILD_NUM 0 +#define __BUILD_NUM 0 #include <stdver.h> #define __PLUGIN_NAME "ListeningTo" #define __FILENAME "ListeningTo.dll" -#define __DESCRIPTION "Handles listening information to/for contacts." -#define __AUTHOR "Ricardo Pescuma Domenecci" +#define __DESCRIPTION "Handles listening information to/for contacts." +#define __AUTHOR "Ricardo Pescuma Domenecci" #define __AUTHOREMAIL "" -#define __AUTHORWEB "https://miranda-ng.org/p/ListeningTo/" -#define __COPYRIGHT "© 2006-2009 Ricardo Pescuma Domenecci" +#define __AUTHORWEB "https://miranda-ng.org/p/ListeningTo/" +#define __COPYRIGHT "© 2006-2009 Ricardo Pescuma Domenecci" |