summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-18 14:45:04 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-18 14:45:04 +0000
commita3385262c10d49a477e1e071a44ebdfd8e4b7d24 (patch)
tree5f5bdfc4b4cefd0cd71ce692e9ffa83d1b26b816 /plugins/StatusPlugins/AdvancedAutoAway/options.cpp
parent0da1d99c8ecda784b14ade348897096dc43a65b4 (diff)
fix: AAA crashes another programs when global hooks are active
git-svn-id: http://svn.miranda-ng.org/main/trunk@2355 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins/AdvancedAutoAway/options.cpp')
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/options.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
index f9599f7b4d..edfeb0aaa8 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
+++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
@@ -31,8 +31,6 @@ static BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
#define ListView_SetCheckState(w,i,f) ListView_SetItemState(w,i,INDEXTOSTATEIMAGEMASK((f)+1),LVIS_STATEIMAGEMASK)
#endif
-static OBJLIST<TAAAProtoSetting> optionSettings( 10, CompareSettings );
-
int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName);
INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -125,6 +123,8 @@ static void SetDialogStatus(HWND hwndDlg, TAAAProtoSetting* sameSetting)
/////////////////////////////////////////////////////////////////////////////////////////
// Rules dialog window procedure
+static OBJLIST<TAAAProtoSetting> *optionSettings;
+
static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static TAAAProtoSetting* sameSetting;
@@ -136,15 +136,16 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
TranslateDialogDefault(hwndDlg);
// copy the settings
- optionSettings = autoAwaySettings;
+ optionSettings = new OBJLIST<TAAAProtoSetting>(10, CompareSettings);
+ *optionSettings = *autoAwaySettings;
sameSetting = ( TAAAProtoSetting* )malloc(sizeof(TAAAProtoSetting));
LoadAutoAwaySetting(*sameSetting, SETTING_ALL);
// fill list from currentProtoSettings
{
- for ( int i=0; i < optionSettings.getCount(); i++ ) {
- TAAAProtoSetting& p = optionSettings[i];
+ for ( int i=0; i < optionSettings->getCount(); i++ ) {
+ TAAAProtoSetting& p = (*optionSettings)[i];
int item = SendDlgItemMessage( hwndDlg, IDC_PROTOCOL, CB_ADDSTRING, 0, ( LPARAM )p.tszAccName );
SendDlgItemMessage( hwndDlg, IDC_PROTOCOL, CB_SETITEMDATA, item, (LPARAM)&p );
}
@@ -351,15 +352,15 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
if (bSettingSame)
WriteAutoAwaySetting(*sameSetting, SETTING_ALL);
else {
- for (int i=0; i < optionSettings.getCount(); i++ )
- WriteAutoAwaySetting(optionSettings[i], optionSettings[i].szName);
+ for (int i=0; i < optionSettings->getCount(); i++ )
+ WriteAutoAwaySetting((*optionSettings)[i], (*optionSettings)[i].szName);
}
- LoadOptions(autoAwaySettings, FALSE);
+ LoadOptions(*autoAwaySettings, FALSE);
}
break;
case WM_DESTROY:
- optionSettings.destroy();
+ optionSettings->destroy();
free(sameSetting);
break;
}
@@ -419,7 +420,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA
DBWriteContactSettingWord(NULL, MODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, NULL, FALSE));
DBWriteContactSettingByte(NULL, MODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE));
DBWriteContactSettingByte(NULL, MODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD));
- LoadOptions(autoAwaySettings, FALSE);
+ LoadOptions(*autoAwaySettings, FALSE);
}
break;
}