Modify

Opened 2 months ago

#4026 new Bug

COM Object/Map/ScriptingDictionary crash when acessing them in specific ways.

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.3.16.1 Severity: None
Keywords: Cc:

Description

it's a rather rare teeny-tiny bug, and there's an easy workaround... still...

Reproducer:

$inp = InputBox('choice', 'test Object(1), Map(2), or ScriptingDictionary(3)?', '1')
if @error then exit
if $inp = 1 then ; -- COM object -- 
#Illegal text at the end of statement (one statement per line).
        Run("notepad.exe")
        $hNotepad = WinWait("[CLASS:Notepad]")
        $answer = MsgBox(0x24,'...', 'Delete notepad icon from taskbar?')
        if $answer=6 then TaskbarListObj().DeleteTab($hNotepad) ;crashes -- "Illegal text at the end of statement (one statement per line)."
;~      if $answer=6 then (TaskbarListObj().DeleteTab($hNotepad)) ; a workaround that works

elseif $inp = 2 then ; -- Map --
#The requested action with this object has failed.
        $m = Map()
        ConsoleWrite("$m.greet's type:"&VarGetType($m.greet) & @CRLF)
        $m.greet() ; - crashes: "The requested action with this object has failed."

else  ; -- ScriptingDictionary -- 
#Illegal text at the end of statement (one statement per line).
        ((Dict())('fn'))(1) ; works
        (Dict())('fn')(2) ; doesnt, yet no crash, no error, no nothing...
        (Dict()('fn'))(3) ; works
        Dict()('fn')(4) ; crashes

EndIf

Func TaskbarListObj()
        Local $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}"
        Local $sIID_ITaskbarList = "{56FDF342-FD6D-11D0-958A-006097C9A090}"
        Local $sTagITaskbarList = "HrInit hresult(); AddTab hresult(hwnd); DeleteTab hresult(hwnd); ActivateTab hresult(hwnd); SetActiveAlt hresult(hwnd);"
        Local $oTaskbarList = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList, $sTagITaskbarList)
        $oTaskbarList.HrInit()
        Return $oTaskbarList
EndFunc
Func Map()
        Local $m[]
        $m.greet = sayhi
        Return $m
EndFunc
Func sayhi()
        MsgBox(0x40,'welp','...hi....')
EndFunc
Func Dict()
        Local $d = ObjCreate('Scripting.Dictionary')
        $d('fn') = sayhey
        Return $d
EndFunc
Func sayhey($n)
        ConsoleWrite(' \ o/ heeeey ' &$n& @CRLF)
EndFunc

Attachments (0)

Change History (0)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.