[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: Fri, 8 Jan 2016 02:00:44 +0300

On 8 January 2016 at 01:01, Stefan Küng <tortoisesvn_at_gmail.com> wrote:
> On 07.01.2016 21:29, Ivan Zhakov wrote:
>> 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.
>
> Sorry for the late reply:
> Yes, TortoiseProc initializes COM at startup. Other calls to
> CoInitialize/CoInitializeEx are there for thread reasons (COM has to be
> initialized for each thread separately if needed).
>
I was confused by COM initialization in
CTortoiseProcApp::InitializeJumpList(), which happens on the main
thread.

-- 
Ivan Zhakov
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=3154173
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2016-01-08 12:26:48 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.