mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Fixed another serious bug where deleting menus and not returning PLUGIN_HANDLED would cause the iterator to fail and crash
This commit is contained in:
parent
c15a23a2a7
commit
db7dc509e0
@ -87,6 +87,10 @@ void MenuMngr::removeMenuId(int id)
|
||||
{
|
||||
if (c->menuid == id)
|
||||
{
|
||||
if (m_watch_iter.a == c)
|
||||
{
|
||||
++m_watch_iter;
|
||||
}
|
||||
if (lc)
|
||||
lc->next = c->next;
|
||||
else
|
||||
@ -140,4 +144,13 @@ void MenuMngr::clear()
|
||||
}
|
||||
}
|
||||
|
||||
MenuMngr::iterator MenuMngr::SetWatchIter(MenuMngr::iterator iter)
|
||||
{
|
||||
MenuMngr::iterator old = m_watch_iter;
|
||||
|
||||
m_watch_iter = iter;
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
int MenuMngr::MenuIdEle::uniqueid = 0;
|
||||
|
@ -76,7 +76,8 @@ private:
|
||||
} *headcmd;
|
||||
|
||||
public:
|
||||
MenuMngr() { headid = 0; headcmd = 0; }
|
||||
MenuMngr() : m_watch_iter(end())
|
||||
{ headid = NULL; headcmd = NULL; }
|
||||
~MenuMngr();
|
||||
|
||||
// Interface
|
||||
@ -89,6 +90,7 @@ public:
|
||||
|
||||
class iterator
|
||||
{
|
||||
friend class MenuMngr;
|
||||
MenuCommand* a;
|
||||
public:
|
||||
iterator(MenuCommand*aa) : a(aa) {}
|
||||
@ -101,6 +103,11 @@ public:
|
||||
|
||||
inline iterator begin() const { return iterator(headcmd); }
|
||||
inline iterator end() const { return iterator(0); }
|
||||
|
||||
MenuMngr::iterator SetWatchIter(MenuMngr::iterator iter);
|
||||
inline MenuMngr::iterator GetWatchIter() { return m_watch_iter; }
|
||||
private:
|
||||
MenuMngr::iterator m_watch_iter;
|
||||
};
|
||||
|
||||
#endif //MENUS_H
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
#define AMXXLOG_Log g_log.Log
|
||||
#define AMXXLOG_Error g_log.LogError
|
||||
#define AMX_VERSION "1.76b"
|
||||
#define AMX_VERSION "1.76c"
|
||||
|
||||
extern AMX_NATIVE_INFO core_Natives[];
|
||||
extern AMX_NATIVE_INFO time_Natives[];
|
||||
|
@ -901,6 +901,7 @@ void C_ClientCommand(edict_t *pEntity)
|
||||
pPlayer->menu = 0;
|
||||
|
||||
MenuMngr::iterator a = g_menucmds.begin();
|
||||
MenuMngr::iterator old = g_menucmds.SetWatchIter(a);
|
||||
|
||||
while (a)
|
||||
{
|
||||
@ -940,9 +941,16 @@ void C_ClientCommand(edict_t *pEntity)
|
||||
if (ret & 1) RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
}
|
||||
if (g_menucmds.GetWatchIter() != a)
|
||||
{
|
||||
a = g_menucmds.GetWatchIter();
|
||||
} else {
|
||||
++a;
|
||||
}
|
||||
}
|
||||
|
||||
g_menucmds.SetWatchIter(old);
|
||||
}
|
||||
}
|
||||
|
||||
/* check for PLUGIN_HANDLED_MAIN and block hl call if needed */
|
||||
|
@ -778,10 +778,6 @@
|
||||
RelativePath="..\md5.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\menus.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\messages.h"
|
||||
>
|
||||
|
@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,7,6,2
|
||||
PRODUCTVERSION 1,7,6,2
|
||||
FILEVERSION 1,7,6,3
|
||||
PRODUCTVERSION 1,7,6,3
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -45,12 +45,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "Comments", "AMX Mod X"
|
||||
VALUE "FileDescription", "AMX Mod X"
|
||||
VALUE "FileVersion", "1.76b"
|
||||
VALUE "FileVersion", "1.76c"
|
||||
VALUE "InternalName", "amxmodx"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2004-2006, AMX Mod X Dev Team"
|
||||
VALUE "OriginalFilename", "amxmodx_mm.dll"
|
||||
VALUE "ProductName", "AMX Mod X"
|
||||
VALUE "ProductVersion", "1.76b"
|
||||
VALUE "ProductVersion", "1.76c"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
Loading…
Reference in New Issue
Block a user