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

Re: Tortoise brings down xplorer2

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: 2006-05-11 13:14:12 CEST

zabkat info wrote:
> I think we have found at least one problem:
>> STGMEDIUM medium;
>> FORMATETC fmte = {(CLIPFORMAT)g_shellidlist,
>> -1,
>> HRESULT hres = pDataObj->GetData(&fmte, &medium);
>> if (SUCCEEDED(hres) && medium.hGlobal)
>> {
>> //Enumerate PIDLs which the user has selected
>> CIDA* cida = (CIDA*)medium.hGlobal;
>> LPCITEMIDLIST parent = GetPIDLFolder(cida);
> Microsoft also did that mistake, casting a HANDLE into a pointer. See this
> post and in particular the comments made by Jim Barry at the very end:
> http://groups.google.com/group/microsoft.public.platformsdk.shell/browse_thr
> ead/thread/52fd75ef9cdd38f0/a0f0771a3334f7fb?lnk=st&q=SHMultiFileProperties&
> rnum=1&hl=en#a0f0771a3334f7fb

According to that post, MS did the same up to Win2k. So I guess even if
it's a bug in TSVN, you should not allocate movable memory there either,
or you could get into trouble for pre-XP systems.

> Standard OLE procedures mean that you cannot use a global handle straight,
> but you have to lock it first as such:
> CIDA* cida = (CIDA*)GlobalLock(medium.hGlobal);
> This converts it from a meaningless handle to a proper memory location.
> After you're done and before releasing the medium you should unlock it as
> such:
> GlobalUnlock(medium.hGlobal);

Yep. That fixes the crash.
Committed the fix in revision 6472 - will be in the 1.4.0 release.

> Also I'm not sure what this statement does:
>> LPCITEMIDLIST _parent = GetPIDLItem(cida, i), &parent);
> Unbalanced parentheses, surely?

Mistake when preparing the code for the mail - as I said this wasn't the
real code but I had to leave out a lot (otherwise I had to include some
helper classes too).


   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu May 11 13:14:29 2006

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.