Author Topic: Right click on any tool-window title bar gives slick c stack  (Read 2350 times)

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Right click on any tool-window title bar gives slick c stack
« on: September 17, 2018, 11:38:33 AM »
I'm not sure if you should spend any time investigating this as it seems that loading my xretrace macro code causes this problem.

Right click on any toolwindow title bar gives the stack error below.  I can't reproduce this on a clean config but if I start a clean config then load all my macro files then I get the following stack every single time.  BTW - if I also import my options I get two errors in the message list  - both regarding "Minimap font does not exist on this machine".

 Invalid name index
toolwindow.ex 11357 _on_tool_tab_context_menu(343,Projects,343,Projects,0)   p_window_id: 343   p_object: OI_FORM   p_name: _tbprojects_form

To reproduce, start a new empty config, unzip the folders in the attachment into the config folder, then load the file LoadMyModules.e from the my-macros folder and run the command load-my-modules.  It will prompt for the folder - just click ok, then it will load my macro files one by one - just click ok for all.  When it's finished, right click on the titlebar of any toolwindow and you should get a  slick stack. 

I'm not 100% sure that it's xretrace that's the problem.  xretrace.e is a little unusual in that it #includes xretrace_control_panel.e which #includes xretrace_form.e.
xretrace_control_panel.e has some macros (#defines) that do some code generation.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6867
  • Hero Points: 528
Re: Right click on any tool-window title bar gives slick c stack
« Reply #1 on: September 17, 2018, 08:53:37 PM »
I'm going to investigate this. Another user got this "Invalid name index" error at the same spot and we have had a hard time reproducing it here. Maybe your test case is easier to make it happen.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6867
  • Hero Points: 528
Re: Right click on any tool-window title bar gives slick c stack
« Reply #2 on: September 17, 2018, 09:24:07 PM »
Reproduced. Not sure what's going on yet.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6867
  • Hero Points: 528
Re: Right click on any tool-window title bar gives slick c stack
« Reply #3 on: September 17, 2018, 10:49:07 PM »
Thanks for posting about this one!!!

It turns out that it's possible for a Slick-C object index (menu or form) to be negative due to the way they are handled. You just need to insert enough Slick-C symbols like what you're doing. This weirdness allows Slick-C to differentiate between windows ids and object indexes (wid.p_caption="whatever" vs index.p_caption="whatever").

I found a number of macros which are using < and > operators on indexes. There were also a couple problems in the C++ handling of negative object indexes.

This will be fixed in beta 5. There really isn't a great workaround for this. Anywhere Slick-C creates menus on the fly, the indexes can be negative.
« Last Edit: September 18, 2018, 01:23:56 PM by Clark »