Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: BlueHazzard on June 17, 2013, 12:33:32 am

Title: script not refreshed from file
Post by: BlueHazzard on June 17, 2013, 12:33:32 am
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)
Code
int id = wxNewId();
            mi.CreateFromString(arr[i], id);

Here the menue entry is "not" created because it exists:
Code
// 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
Title: Re: script not refreshed from file
Post by: BlueHazzard on June 17, 2013, 01:20:03 am
quick and dirty hack, without changing the sdk interface to much...
please test

greetings
Title: Re: script not refreshed from file
Post by: oBFusCATed on June 17, 2013, 02:16:18 am
What about a proper solution, no matter if you have to change the SDK?
Title: Re: script not refreshed from file
Post by: BlueHazzard on June 17, 2013, 09:38:03 am
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