1
0
Fork 0

DBG: fixed a bug in _plugin_menuclear (now it no longer deletes the menu itself)

This commit is contained in:
mrexodia 2017-08-08 01:17:25 +02:00
parent afd18d870f
commit caae4a9d6a
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 6 additions and 5 deletions

View File

@ -85,7 +85,7 @@ PLUG_IMPEXP bool _plugin_menuaddseparator(int hMenu)
PLUG_IMPEXP bool _plugin_menuclear(int hMenu)
{
return pluginmenuclear(hMenu);
return pluginmenuclear(hMenu, false);
}
PLUG_IMPEXP void _plugin_menuseticon(int hMenu, const ICONDATA* icon)

View File

@ -352,7 +352,7 @@ bool pluginunload(const char* pluginName, bool unloadall)
}
{
EXCLUSIVE_ACQUIRE(LockPluginList);
pluginmenuclear(currentPlugin.hMenu);
pluginmenuclear(currentPlugin.hMenu, true);
//remove from main pluginlist. We do this so unloadall doesn't try to unload an already released plugin
auto pbegin = pluginList.begin();
@ -673,7 +673,7 @@ bool pluginmenuaddseparator(int hMenu)
\param hMenu The menu to clear.
\return true if it succeeds, false otherwise.
*/
bool pluginmenuclear(int hMenu)
bool pluginmenuclear(int hMenu, bool erase)
{
EXCLUSIVE_ACQUIRE(LockPluginMenuList);
bool bFound = false;
@ -682,7 +682,8 @@ bool pluginmenuclear(int hMenu)
const auto & currentMenu = *it;
if(currentMenu.hEntryMenu == hMenu && currentMenu.hEntryPlugin == -1)
{
it = pluginMenuList.erase(it);
if(erase)
it = pluginMenuList.erase(it);
bFound = true;
}
}

View File

@ -74,7 +74,7 @@ bool plugincmdunregister(int pluginHandle, const char* command);
int pluginmenuadd(int hMenu, const char* title);
bool pluginmenuaddentry(int hMenu, int hEntry, const char* title);
bool pluginmenuaddseparator(int hMenu);
bool pluginmenuclear(int hMenu);
bool pluginmenuclear(int hMenu, bool erase);
void pluginmenucall(int hEntry);
bool pluginwinevent(MSG* message, long* result);
bool pluginwineventglobal(MSG* message);