SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: hs2 on November 28, 2007, 01:05:48 AM

Title: 'push-ref' stack-dump
Post by: hs2 on November 28, 2007, 01:05:48 AM
There is a problem with 'push-ref' (Find references) in conjunction with selective display.
Use case:
file.h (selective display OFF)
Code: [Select]
class Class
{
   ...
   private:
      byte Buffer [ 2 ] [ 4 ];
}

-> find all references of 'Buffer' -> bang !

'Buffer' IS referenced in file.cpp where selective display is ON (used 'toggle-all-outlining' and expanded only a few methods)

Quote
Slick-C STACK TRACE ******************************
 Created on 11/28/2007 at 1:48:25 (484 ms)
 SlickEdit Version 12.0.3.0 Copyright 1988-2007 SlickEdit Inc.
 Edit module and type "st -f <offset>" to get the
 run-time error position

 error code=-3015
 Invalid argument

csymbols.ex 2478 get_text_safe(-248,93219)   p_window_id: 492   p_object: OI_EDITOR   p_name:
csymbols.ex 8007 _c_get_expression_info(0,
   2:   [1]=
   2:   [2]=
   2:   [3]=0
   2:   [4]=0
   2:   [5]=524290
   2:   [6]=
   2:   [7]=0
   p_window_id: 492
   p_object: OI_EDITOR
   p_name:
codehelputil.ex 6122 _do_extension_get_idexp_info(<empty>,0,,,0,0,0,)
   p_window_id: 216
   p_object: OI_TREE_VIEW
   p_name: ctlreferences
And indeed 'open_bracket_pos > close_bracket_pos'...
There is no problem when I find refs of non-array members or when switching OFF selective display in file.cpp.
HS2
Title: Re: 'push-ref' stack-dump
Post by: hs2 on November 29, 2007, 01:42:42 AM
Coz I was trapped too often by this annoying problem and I'm an impatient guy ;) I've implemented a workaround.
Perhaps it's also not that easy to really solve it...

Just in case someone else is interested in a quick 'solution' ... here we go:
csymbols.e - _c_get_expression_info() [line 1473]: (SE v12.0.3)
Code: [Select]
         } else if (get_text_safe()=='[') {
            idexp_info.info_flags|=VSAUTOCODEINFO_LASTID_FOLLOWED_BY_BRACKET;
            long open_bracket_pos=_QROffset();
            // HS2-CHG: #1 - maybe temp expand collapsed lines
            //          to WA the problem that close_bracket_pos < open_bracket_pos when finding refs of
            //          array vars/members in collapsed buffers causing a nasty stack dump
            boolean undoExpand = false;
            if (_lineflags() & HIDDEN_LF)
            {
               undoExpand = true;
               _undo ('S');
               expand_line_level();
            }
            // HS2-CHG: #1 - end
            if (!find_matching_paren(true)) {
               long close_bracket_pos=_QROffset();
               idexp_info.otherinfo=get_text_safe((int)(close_bracket_pos-open_bracket_pos-1),(int)(open_bracket_pos+1));
               idexp_info.otherinfo=stranslate(idexp_info.otherinfo,'','\/\/?*[\n\r]','r');
               idexp_info.otherinfo=stranslate(idexp_info.otherinfo,'','[ \t\n\r]#','r');
               idexp_info.otherinfo=stranslate(idexp_info.otherinfo,'','\/\*?*\*\/','r');
            }
            // HS2-CHG: #2 - maybe undo temp expanded lines
            if ( undoExpand ) _undo();
            // HS2-CHG: #2 - end
            if (idexp_info.otherinfo=='') {
               idexp_info.info_flags&=~VSAUTOCODEINFO_LASTID_FOLLOWED_BY_BRACKET;
            }
            _GoToROffset(open_bracket_pos);
         }

HS2