From 693d04baec34aaf899822dc8d1180ab43ebda518 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 19 Apr 2018 20:38:29 +0300 Subject: code simplification --- src/mir_app/src/options.cpp | 8 ++++++-- src/mir_app/src/pluginopts.cpp | 13 +++---------- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 7c36c04fb3..c6780393f2 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -842,6 +842,9 @@ public: PSHNOTIFY pshn = {}; pshn.hdr.code = PSN_APPLY; for (auto &p : m_arOpd) { + if (p == nullptr) + continue; + if (p->getHwnd() == nullptr || !p->bChanged) continue; @@ -1087,7 +1090,6 @@ public: delete it; m_arOpd.remove(idx); } - m_arDeleted.destroy(); RebuildPageTree(); } @@ -1133,8 +1135,10 @@ public: } m_arDeleted.insert(opd); - m_timerRebuild.Start(50); } + + if (m_arDeleted.getCount()) + m_timerRebuild.Start(50); } }; diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 9ace80867a..2776b4635d 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -227,7 +227,6 @@ class CPluginOptDlg : public CDlgBase CMStringW m_szFilter; bool needRestart = false; - CMStringW wszMsgRestart; CMStringA szUrl; public: @@ -356,16 +355,10 @@ public: LoadStdPlugins(); ShowWindow(GetDlgItem(m_hwnd, IDC_RESTART), needRestart); - if (needRestart) - wszMsgRestart = bufRestart; - } - - virtual void OnClose() override - { if (needRestart) { - wszMsgRestart.AppendChar('\n'); - wszMsgRestart.Append(TranslateT("Do you want to restart it now?")); - if (MessageBox(m_hwnd, wszMsgRestart, L"Miranda NG", MB_ICONWARNING | MB_YESNO) == IDYES) + bufRestart.AppendChar('\n'); + bufRestart.Append(TranslateT("Do you want to restart it now?")); + if (MessageBox(m_hwnd, bufRestart, L"Miranda NG", MB_ICONWARNING | MB_YESNO) == IDYES) CallService(MS_SYSTEM_RESTART, 1, 0); } } -- cgit v1.2.3