[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: COM initialization in TortoiseProc

From: Ivan Zhakov <ivan_at_visualsvn.com>
Date: Thu, 7 Jan 2016 23:29:03 +0300

On 7 January 2016 at 12:12, Ivan Zhakov <ivan_at_visualsvn.com> wrote:
> I'm currently looking to drdump problem 178870 [1]. Crash happens in
> internals of SHGetFileInfoW which called from CTortoiseProcApp
> constructor:
> [[[
> ole32!OXIDEntry::InitRundown+0xd
> ole32!CComApartment::InitRemoting+0x1d3
> ole32!CComApartment::StartServer+0x13
> [...]
> ole32!CoCreateInstanceEx+0x38
> ole32!CoCreateInstance+0x37
> [...]
> shell32!SHGetFileInfoW+0x18f
> tortoiseproc!CSysImageList::CSysImageList+0xb7
> tortoiseproc!CTortoiseProcApp::CTortoiseProcApp+0x9a
> ]]]
>
> Looking to the code I noticed that SHGetFileInfoW called without prior
> COM initialization while it's explicitly required by MSDN [2]:
> [[[
> You must initialize Component Object Model (COM) with CoInitialize or
> OleInitialize prior to calling SHGetFileInfo.
> ]]]
>
> So I suspect that this is the reason of this crash.
>
> I wanted to add COM initialization to CTortoiseProcApp constructor,
> but I noticed that TortoiseSVN code uses pattern to initialize COM
> only when needed instead of application start. Is it intentional? Are
> any known problems to initialize COM on TortoiseProc startup?
>
My bad: I added breakpoint to CoInitalize(), but I forgot about
CoInitializeEx(). COM is initialized at TortoiseProc startup in
CTortoiseProcApp::InitInistance(). So I've moved CSysImageList
initizilization here (and cleanup to ExitInstance) in r27133.

-- 
Ivan Zhakov
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=3154165
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2016-01-07 22:56:07 CET

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.