Re: COM initialization in TortoiseProc
Ivan Zhakov <[email protected]>
| Newsgroups | gmane.comp.version-control.subversion.tortoisesvn.devel |
|---|---|
| Message-ID | <CABw-3YeYJrAGsBU+3rTc52CpDP3Zqf+5t9WKBdEHVkNLyfpDSg@mail.gmail.com> |
On 8 January 2016 at 01:01, Stefan Küng <[email protected]> wrote: > On 07.01.2016 21:29, Ivan Zhakov wrote: >> On 7 January 2016 at 12:12, Ivan Zhakov <[email protected]> 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: [[email protected]].