News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

script not refreshed from file

Started by BlueHazzard, June 17, 2013, 12:33:32 AM

Previous topic - Next topic

BlueHazzard

Hello!
it might be to late, but i have found a bug in the squirrel binding:
if my squirrel script (registered as plugin) creates a menu entry, and if i reload (open an register) the srcript a second time it wont be actualized to the new script.
It calls the old one.


in wxArrayInt CreateMenu(const wxString& name)

int id = wxNewId();
           mi.CreateFromString(arr[i], id);


Here the menue entry is "not" created because it exists:
// existing menu
               // if it is the final item we want to create, display error and stop
               if (isLast || existing >= (int)menu->GetMenuItemCount())
                   return 0;


so a easy fix would be to add a bool parameter who signals to overwrite the old menu entry, or we ask at the script loading if the existing menu entry should be overwritten.
Probably it should be overwritten if the old and the new plugin had the same name...
Or we need in the menumanager a function to delete a menu so we can call it, when the plugin is unregistered (but how we find the right menu entry?).

greetings

BlueHazzard

quick and dirty hack, without changing the sdk interface to much...
please test

greetings

oBFusCATed

What about a proper solution, no matter if you have to change the SDK?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

BlueHazzard

I thought sdk interface changing aren't allowed...

i have uploaded a patch with the proper fix (i think). Still needs testing!

Patch ID: 003480