Author Topic: script not refreshed from file  (Read 6039 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
script not refreshed from file
« 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

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: script not refreshed from file
« Reply #1 on: June 17, 2013, 01:20:03 am »
quick and dirty hack, without changing the sdk interface to much...
please test

greetings

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: script not refreshed from file
« Reply #2 on: June 17, 2013, 02:16:18 am »
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!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: script not refreshed from file
« Reply #3 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