[a104] comObject crash Topic is solved

Discuss the future of the AutoHotkey language
User avatar
aseiot
Posts: 31
Joined: 05 Mar 2017, 04:25

[a104] comObject crash

27 Aug 2019, 09:27

The comObject crashed in some instance.

This is part of code from ShellRun:

Code: Select all

    shellWindows := ComObjCreate("Shell.Application").Windows
	VarSetCapacity(_hwnd, 4, 0)
    desktop := shellWindows.FindWindowSW(0, "", 8, ComObject(0x4003, &_hwnd), 1)		; Crash here
User avatar
aseiot
Posts: 31
Joined: 05 Mar 2017, 04:25

Re: [a104] comObject crash

27 Aug 2019, 17:59

That may be more. i.e.

Code: Select all

oHTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1")
oHTTP.Open("GET", "http://autohotkey.com", True)		; crash
swagfag
Posts: 2843
Joined: 11 Jan 2017, 17:59

Re: [a104] comObject crash

28 Aug 2019, 03:15

script_com.cpp:1158 wrote:

Code: Select all

1153: for (int i = 1; i <= aParamCount; i++)
1154: {
1155:     // TokenToVariant() in "arg" mode never calls AddRef() or SafeArrayCopy(), so the arg needs to be freed
1156:     // only if it is a BSTR and not one which came from a ComObject wrapper (such as ComObject(9, pbstr)).
1157:     if (rgvarg[i].vt == VT_BSTR && aParam[aParamCount-i]->symbol != SYM_OBJECT)
1158:         SysFreeString(rgvarg[i-1].bstrVal); // <<<
1159: }
0xC0000005 Access violation
tries to free something it shouldnt
User avatar
aseiot
Posts: 31
Joined: 05 Mar 2017, 04:25

Re: [a104] comObject crash  Topic is solved

11 Sep 2019, 10:00

Fixed in the latest git head.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 9 guests