It is currently Thu Jan 18, 2018 1:15 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [5.61, 5.62b1] Scintilla AutoComplete crashes
PostPosted: Thu Jan 11, 2018 2:18 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1490
More Mac problems since upgrading to High Sierra... :(

Here is a Scintilla AutoComplete example. It works fine on Windows, and also on MacOS 10.12-

On MacOS 10.13 High Sierra, as I type letters I get multiple AutoComplete windows on top of each other, and if I click on the older ones the program crashes with NULL string or "executing binary data" strange errors.

Code:
Global NewList ACWord.s()
AddElement(ACWord()) : ACWord() = "End"
AddElement(ACWord()) : ACWord() = "EndDataSection"
AddElement(ACWord()) : ACWord() = "EndDeclare"
AddElement(ACWord()) : ACWord() = "EndEnumeration"
AddElement(ACWord()) : ACWord() = "EndIf"
AddElement(ACWord()) : ACWord() = "EndImport"
AddElement(ACWord()) : ACWord() = "EndInterface"
AddElement(ACWord()) : ACWord() = "EndMacro"
AddElement(ACWord()) : ACWord() = "EndModule"
AddElement(ACWord()) : ACWord() = "EndProcedure"
AddElement(ACWord()) : ACWord() = "EndSelect"
AddElement(ACWord()) : ACWord() = "EndStructure"
AddElement(ACWord()) : ACWord() = "EndWith"

Procedure CB(Gadget.i, *scn.SCNotification)
  If (*scn\nmhdr\code = #SCN_CHARADDED)
    Pos.i = ScintillaSendMessage(Gadget, #SCI_GETCURRENTPOS)
    StartPos.i = ScintillaSendMessage(Gadget, #SCI_WORDSTARTPOSITION, Pos, #True)
    If (Pos - StartPos > 2)
      Prefix.s = ""
      For i = StartPos To Pos
        Prefix + Chr(ScintillaSendMessage(Gadget, #SCI_GETCHARAT, i))
      Next i
      ;Debug Prefix
     
      WordList.s = ""
      Static PrevWordList.s
      If (Prefix)
        ForEach (ACWord())
          If (LCase(Prefix) = LCase(Left(ACWord(), Len(Prefix))))
            WordList + " " + ACWord()
            ;Debug WordList
          EndIf
        Next
      Else
        WordList = ""
      EndIf
      WordList = Mid(WordList, 2)
     
      If (WordList) And (LCase(WordList) <> LCase(Prefix))
        If (Not ScintillaSendMessage(Gadget, #SCI_AUTOCACTIVE)) Or (WordList <> PrevWordList)
          PrevWordList = WordList
          ;Debug PrevWordList
          *Asc = Ascii(PrevWordList)
          ScintillaSendMessage(Gadget, #SCI_AUTOCSHOW, Len(Prefix), *Asc)
          FreeMemory(*Asc)
        EndIf
      Else
        ScintillaSendMessage(Gadget, #SCI_AUTOCCANCEL)
      EndIf
    EndIf
  EndIf
EndProcedure

InitScintilla()
OpenWindow(0, 0, 0, 640, 480, "Autocomplete", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
ScintillaGadget(0, 0, 0, 640, 480, @CB())
ScintillaSendMessage(0, #SCI_AUTOCSETIGNORECASE, #True)
;ScintillaSendMessage(0, #SCI_SETMARGINWIDTHN, 1, 0)
SetClipboardText("Try typing 'EndDataSection'" + #LF$ + #LF$ +
    "Multiple windows appear... click one and it crashes..." + #LF$ + #LF$)
ScintillaSendMessage(0, #SCI_PASTE)
SetActiveGadget(0)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow




But this does NOT happen to the PB IDE, like this other High Sierra Scintilla bug:
www.purebasic.fr/english/viewtopic.php?f=24&t=69842


Top
 Profile  
Reply with quote  
 Post subject: Re: [5.61, 5.62b1] Scintilla AutoComplete crashes
PostPosted: Thu Jan 11, 2018 2:28 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1490
I think this answers it:
https://sourceforge.net/p/scintilla/bugs/1981/

Looks like a Scintilla bug, fixed in November 2017... but there hasn't been a Scintilla release since October 2017...
http://www.scintilla.org/ScintillaHistory.html


Top
 Profile  
Reply with quote  
 Post subject: Re: [5.61, 5.62b1] Scintilla AutoComplete crashes
PostPosted: Thu Jan 11, 2018 9:09 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13183
Location: France
Thanks for digging it, I will apply the patch on our branch so it should be fixed for next beta.


Top
 Profile  
Reply with quote  
 Post subject: Re: [5.61, 5.62b1] Scintilla AutoComplete crashes
PostPosted: Fri Jan 12, 2018 2:43 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1490
That's good. Do you have a custom build of Scintilla you use for PB Mac?


PS. Any idea why this bug doesn't affect PB IDE on High Sierra?
Does the IDE create its own Autocomplete popup window?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye