mirror of
https://github.com/cemu-project/idapython.git
synced 2025-05-01 03:52:03 +02: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
|
return 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ctx
|
ex_addmenu_item_ctx
|
||||||
idaapi.del_menu_item(ctx)
|
idaapi.del_menu_item(ex_addmenu_item_ctx)
|
||||||
print("Menu removed")
|
print("Menu removed")
|
||||||
del ctx
|
del ex_addmenu_item_ctx
|
||||||
except:
|
except:
|
||||||
ctx = idaapi.add_menu_item("Search/", "X", "", 0, cb, tuple("hello world"))
|
ex_addmenu_item_ctx = idaapi.add_menu_item("Search/", "X", "", 0, cb, tuple("hello world"))
|
||||||
if ctx is None:
|
if ex_addmenu_item_ctx is None:
|
||||||
print("Failed to add menu!")
|
print("Failed to add menu!")
|
||||||
del ctx
|
del ex_addmenu_item_ctx
|
||||||
else:
|
else:
|
||||||
print("Menu added successfully. Run the script again to delete the menu")
|
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;
|
bool no_args;
|
||||||
|
|
||||||
|
// No slash in the menu path?
|
||||||
|
const char *p = strrchr(menupath, '/');
|
||||||
|
if ( p == NULL )
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
if ( args == Py_None )
|
if ( args == Py_None )
|
||||||
{
|
{
|
||||||
no_args = true;
|
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();
|
py_add_del_menu_item_ctx *ctx = new py_add_del_menu_item_ctx();
|
||||||
|
|
||||||
// Form the complete menu path
|
// Form the complete menu path
|
||||||
ctx->menupath = menupath;
|
ctx->menupath.append(menupath, p - menupath + 1);
|
||||||
ctx->menupath.append(name);
|
ctx->menupath.append(name);
|
||||||
// Save callback data
|
// Save callback data
|
||||||
ctx->cb_data = cb_data;
|
ctx->cb_data = cb_data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user