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

Re: Strange pattern with a dangling pointer in TProc

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Tue, 23 Nov 2010 19:08:18 +0100

On 23.11.2010 10:14, Dmitry wrote:
> Hey.
>
> Almost any class implementing a Tortoise Proc "user command" has a pattern like the following:
>
> void CClass::Execute()
> {
> CSVNProgressDlg progDlg;
> theApp.m_pMainWnd =&progDlg;
> // create dialog, run modal loop, exit
> }
>
> When the function exits the dialog object is destroyed, but m_pMainWnd in the global object is kept unchanged and now stores a dangling pointer. Is there any reason for that? If not - I could send in a fix.

No need to mangle with that:
http://msdn.microsoft.com/en-us/library/f3ddxzww%28VS.80%29.aspx
http://jasonshl.spaces.live.com/blog/cns!8A8FB6137A9C9215!197.entry

The framework recognizes that the dialog window is destroyed and acts
accordingly.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2685133
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2010-11-23 19:08:50 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.