SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: jporkkahtc on June 11, 2021, 04:43:28 pm

Title: Bringing VS to front always opens a file...
Post by: jporkkahtc on June 11, 2021, 04:43:28 pm
This is a new thing - it first happened to me a few days ago, but today it is happening again, but with a different file.

Slickedit is running.
From a separate CMD window, I type "vs"
Normally this just brings Slickedit to front.

Now, it also opens a specific file (C:\src\file.bat).

From the cmd prompt, if I do
Code: [Select]
vs OtherFile.txt
Slick behaves as expected, but then
Code: [Select]
vs
slick again opens (or makes active) C:\src\file.bat


Earlier I did have a 2nd instance of Slickedit open (via vs +new), but currently I have only the original instance open.
Title: Re: Bringing VS to front always opens a file...
Post by: Clark on June 12, 2021, 06:14:30 pm
Did you set the "VSLICK" environment variable? This is used to add arguments to every invocation.
Title: Re: Bringing VS to front always opens a file...
Post by: jporkkahtc on June 13, 2021, 01:25:44 am
No, and restarting Slickedit fixes the problem.
Seems like slick is somehow hanging on to some state it shouldn't.
Title: Re: Bringing VS to front always opens a file...
Post by: Clark on June 13, 2021, 01:51:30 am
Tricky issue. Make sure there isn’t an extra SlickEdit process running. Long shot guess.
Title: Re: Bringing VS to front always opens a file...
Post by: jporkkahtc on June 19, 2021, 12:43:02 am
Happening again right now.
Only one slick process open.
I don't think I've recently had a 2nd slick (via vs -new).
Anything I can do to help diagnose?
Title: Re: Bringing VS to front always opens a file...
Post by: Clark on June 19, 2021, 11:44:56 am
I you got a config that reproduces every time, zip it up and upload it.
Title: Re: Bringing VS to front always opens a file...
Post by: jporkkahtc on June 19, 2021, 05:36:31 pm
Nope, it just happens maybe once a week.
If I restart slickedit, the problem goes away.
Title: Re: Bringing VS to front always opens a file...
Post by: Clark on June 19, 2021, 07:23:55 pm
Next time it happens, type “fexit” on the SlickEdit command line. This will exit SlickEdit without save files or overwriting any config files. Then you can try again to see if it reproduces and fexit again.
Title: Re: Bringing VS to front always opens a file...
Post by: Graeme on June 20, 2021, 10:37:30 am
You could use the _StackDump function to see the call stack.  I guess slick thinks the cmdline had a filename on it so stackdump probably won't show why slick thought that.

void _buffer_add_check_file(int newBufId, _str bufName, int bufFlags = 0)
{
   if (bufName == "c:/src/file.bat")
   {
      _StackDump(1,1);
      say("bufFlags = " :+ bufFlags);
   }
}

Title: Re: Bringing VS to front always opens a file...
Post by: jporkkahtc on July 20, 2021, 04:41:59 pm
Thanks Graeme.
I got a repro today and using this trick caught it in the slickedit debugger.
I sent email to Clark via support with all the details.

In edit2(), line 622:
         } else if ( letter=='#' ) {
            execute(substr(word_nq,3),'');   /* Execute the command now. */
         } else if (letter=='I') {

word_nq is "-#", but the next stack frame is edit() and there the filename is the full path to the troublesome file.
Maybe a bug in substr() - since word_nq is only 2 characters here.
Internally, are slickedit strings null terminated or counted?
I'm guessing counted.


BTW, from cmd.exe if you enter "VS.exe C:\foobar.txt", word_nq is "-#  C:\foobar.txt"
Title: Re: Bringing VS to front always opens a file...
Post by: Clark on July 21, 2021, 03:01:40 pm
While I haven't reproduced this problem, I can see a possibility for this happening.

Try loading this change to files.e.  If it fixes the problem, I'll check it in.
Title: Re: Bringing VS to front always opens a file...
Post by: jporkkahtc on July 21, 2021, 03:53:57 pm
I'll try, though I don't know how to repro -- just happens sometimes.