[QScintilla] QScintilla crash upon second word separator in a string

Phil Thompson phil at riverbankcomputing.com
Mon Apr 2 15:00:36 BST 2012


On Sat, 24 Mar 2012 15:03:41 -0500, Jack Cosgrove <jackcosgrove at gmail.com>
wrote:
> Update on this: I received further crashes with the code alteration I
> produced. Upon further inspection it seemed that the error was occurring
> not because the iterator had proceeded past the end of the raw_apis
> string list, but rather because the iterator was initialized at a
> location not within the range of the string list. That's consistent with
> the behavior I observed, in that the crash would only occur the first
> time function arguments were suggested after application startup. If the
> location of the "it" iterator could be properly initialized somehow,
> such as through the workaround user behavior in my first message, then
> all subsequent function argument suggestions worked correctly.
> 
> With this code starting after line 658 in qsciapis.cpp
> 
> if (it < prep->raw_apis.begin())
>             it = prep->raw_apis.begin();
> 
> I can avoid crashes. However the first time that function arguments
> should be suggested nothing happens. All subsequent suggestions work
> correctly.
> 
> Thanks to Phil and Gedalia for taking the time to help me.

I was able to reproduce this - it seems to be a Linux specific problem,
and maybe even a compiler bug. My best workaround is to add...

    prep->raw_apis.begin();

...to the end of the autoCompletionSelected() method, just after the call
to qLowerBound().

Phil

> On Tue, 2012-03-20 at 12:20 +0000, Phil Thompson wrote:
>> On Sat, 17 Mar 2012 12:58:48 -0500, Jack Cosgrove
>> <jackcosgrove at gmail.com>
>> wrote:
>> > Hi,
>> > 
>> > I am encountering crashes when I try to use autocomplete to fill in
>> > function arguments using the Python lexer. For example, given an API
>> > entry of "foo.bar(foo, bar)", I will always be prompted for foo and
>> > bar,
>> > but if I accept the autocompletion for "bar" and then type an opening
>> > parenthesis my app crashes.
>> > 
>> > Attached is a small example demonstrating this behavior. Type in
"fo",
>> > accept the suggestion, then ".", accept "bar", then "(" to replicate.
>> > 
>> > However, if you type in "fo", accept, then ".bar(", then delete the
>> > "(",
>> > you can then type "(" again and encounter the function argument
>> > suggestion. After this happens the first time the application never
>> > crashes, even if replicating the first procedure on a new line.
>> > 
>> > Thanks to all who reply for your help!
>> 
>> I can't reproduce this with current versions of QScintilla and Qt. What
>> versions are you using?
>> 
>> Phil


More information about the QScintilla mailing list