Skip to content

Commit

Permalink
PluginsManager: cleanup header and fix PluginInfo ctor
Browse files Browse the repository at this point in the history
- Moved the remaining functions in the header to the source file.
- Fixed the order of initialization of members of PluginInfo (LINT)
- Added the missing members from the PluginInfo init list (LINT)

[#29]

Signed-off-by: Jocelyn Legault <jocelynlegault@gmail.com>
  • Loading branch information
joce authored and Thell Fowler committed Dec 21, 2009
1 parent dcedd3c commit c7b91fe
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
32 changes: 32 additions & 0 deletions PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@
const TCHAR * USERMSG = TEXT("This plugin is not compatible with current version of Notepad++.\n\n\
Do you want to remove this plugin from plugins directory to prevent this message from the next launch time?");

PluginInfo::PluginInfo() :
_hLib(NULL),
_pluginMenu(NULL),
_pFuncSetInfo(NULL),
_pFuncGetName(NULL),
_pBeNotified(NULL),
_pFuncGetFuncsArray(NULL),
_pMessageProc(NULL),
_pFuncIsUnicode(NULL),
_funcItems(NULL),
_nbFuncItem(0)
{}

PluginInfo::~PluginInfo()
{
if (_pluginMenu)
::DestroyMenu(_pluginMenu);

if (_hLib)
::FreeLibrary(_hLib);
}



PluginsManager::~PluginsManager() {

for (size_t i = 0 ; i < _pluginInfos.size() ; i++)
Expand Down Expand Up @@ -477,3 +501,11 @@ bool PluginsManager::relayPluginMessages(UINT Message, WPARAM wParam, LPARAM lPa
}
return false;
}

void PluginsManager::pluginCrashAlert(const TCHAR *pluginName, const TCHAR *funcSignature)
{
generic_string msg = pluginName;
msg += TEXT(" just crash in\r");
msg += funcSignature;
::MessageBox(NULL, msg.c_str(), TEXT(" just crash in\r"), MB_OK|MB_ICONSTOP);
}
19 changes: 3 additions & 16 deletions PowerEditor/src/MISC/PluginsManager/PluginsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,8 @@ struct PluginCommand {
};

struct PluginInfo {
PluginInfo() :_hLib(NULL), _pluginMenu(NULL), _pFuncSetInfo(NULL),\
_pFuncGetFuncsArray(NULL), _pFuncGetName(NULL), _funcItems(NULL),\
_nbFuncItem(0){};
~PluginInfo(){
if (_pluginMenu)
::DestroyMenu(_pluginMenu);

if (_hLib)
::FreeLibrary(_hLib);
};
PluginInfo();
~PluginInfo();

HINSTANCE _hLib;
HMENU _pluginMenu;
Expand Down Expand Up @@ -97,12 +89,7 @@ class PluginsManager {
std::vector<PluginCommand> _pluginsCommands;
bool _isDisabled;

void pluginCrashAlert(const TCHAR *pluginName, const TCHAR *funcSignature) {
generic_string msg = pluginName;
msg += TEXT(" just crash in\r");
msg += funcSignature;
::MessageBox(NULL, msg.c_str(), TEXT(" just crash in\r"), MB_OK|MB_ICONSTOP);
};
void pluginCrashAlert(const TCHAR *pluginName, const TCHAR *funcSignature);
};

#define EXT_LEXER_DECL __stdcall
Expand Down

0 comments on commit c7b91fe

Please sign in to comment.