mirror of
https://github.com/cemu-project/idapython.git
synced 2025-01-13 18:39:13 +01:00
- bugfix: idaapi.del_menu_item() was failing to delete some menu items
This commit is contained in:
parent
a12974b66c
commit
7e63ea0747
@ -5,14 +5,14 @@ def cb(*args):
|
||||
return 1
|
||||
|
||||
try:
|
||||
ctx
|
||||
idaapi.del_menu_item(ctx)
|
||||
ex_addmenu_item_ctx
|
||||
idaapi.del_menu_item(ex_addmenu_item_ctx)
|
||||
print("Menu removed")
|
||||
del ctx
|
||||
del ex_addmenu_item_ctx
|
||||
except:
|
||||
ctx = idaapi.add_menu_item("Search/", "X", "", 0, cb, tuple("hello world"))
|
||||
if ctx is None:
|
||||
ex_addmenu_item_ctx = idaapi.add_menu_item("Search/", "X", "", 0, cb, tuple("hello world"))
|
||||
if ex_addmenu_item_ctx is None:
|
||||
print("Failed to add menu!")
|
||||
del ctx
|
||||
del ex_addmenu_item_ctx
|
||||
else:
|
||||
print("Menu added successfully. Run the script again to delete the menu")
|
@ -298,6 +298,11 @@ static PyObject *py_add_menu_item(
|
||||
{
|
||||
bool no_args;
|
||||
|
||||
// No slash in the menu path?
|
||||
const char *p = strrchr(menupath, '/');
|
||||
if ( p == NULL )
|
||||
Py_RETURN_NONE;
|
||||
|
||||
if ( args == Py_None )
|
||||
{
|
||||
no_args = true;
|
||||
@ -334,7 +339,7 @@ static PyObject *py_add_menu_item(
|
||||
py_add_del_menu_item_ctx *ctx = new py_add_del_menu_item_ctx();
|
||||
|
||||
// Form the complete menu path
|
||||
ctx->menupath = menupath;
|
||||
ctx->menupath.append(menupath, p - menupath + 1);
|
||||
ctx->menupath.append(name);
|
||||
// Save callback data
|
||||
ctx->cb_data = cb_data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user