Revision: 7322
http://mahogany.svn.sourceforge.net/mahogany/?rev=7322&view=rev
Author: vadz
Date: 2007-08-20 14:59:03 -0700 (Mon, 20 Aug 2007)
Log Message:
-----------
fixed profile leak in folder preferences dialog; clarified the semantics of
GetProfile()
Modified Paths:
--------------
trunk/M/include/gui/wxDialogLayout.h
trunk/M/src/gui/wxDialogLayout.cpp
trunk/M/src/gui/wxMFolderDialogs.cpp
trunk/M/src/gui/wxOptionsDlg.cpp
Modified: trunk/M/include/gui/wxDialogLayout.h
===================================================================
--- trunk/M/include/gui/wxDialogLayout.h 2007-08-20 10:41:14 UTC (rev
7321)
+++ trunk/M/include/gui/wxDialogLayout.h 2007-08-20 21:59:03 UTC (rev
7322)
@@ -284,7 +284,7 @@
// changes were accepted
bool DoApply();
- // get the profile for event sending
+ // get the profile for event sending: the caller will DecRef() it
virtual Profile *GetProfile() const = 0;
Modified: trunk/M/src/gui/wxDialogLayout.cpp
===================================================================
--- trunk/M/src/gui/wxDialogLayout.cpp 2007-08-20 10:41:14 UTC (rev 7321)
+++ trunk/M/src/gui/wxDialogLayout.cpp 2007-08-20 21:59:03 UTC (rev 7322)
@@ -1422,10 +1422,7 @@
// suspend the profile before anything is written to it
m_profileForButtons = GetProfile();
if ( m_profileForButtons )
- {
- m_profileForButtons->IncRef();
m_profileForButtons->Suspend();
- }
return TRUE;
}
Modified: trunk/M/src/gui/wxMFolderDialogs.cpp
===================================================================
--- trunk/M/src/gui/wxMFolderDialogs.cpp 2007-08-20 10:41:14 UTC (rev
7321)
+++ trunk/M/src/gui/wxMFolderDialogs.cpp 2007-08-20 21:59:03 UTC (rev
7322)
@@ -176,7 +176,7 @@
//else: ignore
}
- // base class pure virtual - return the profile we're working with
+ // base class pure virtual: return the profile we're working with (IncRef'd)
virtual Profile *GetProfile() const
{
if ( m_newFolder && !m_profile )
@@ -941,7 +941,7 @@
CHECK( m_newFolder, FALSE, _T("no folder in folder properties dialog") );
wxString folderName = m_newFolder->GetFullName();
- Profile *profile = GetProfile();
+ Profile_obj profile(GetProfile());
// use SetFolderPath() so the page will read its data from the profile
// section corresponding to our folder
@@ -949,8 +949,6 @@
SetPagesProfile(profile);
- profile->DecRef();
-
return wxFolderBaseDialog::TransferDataToWindow();
}
@@ -1187,6 +1185,8 @@
CHECK_RET( dlg, _T("folder page should be in folder dialog!") );
+ event.Skip();
+
wxObject *objEvent = event.GetEventObject();
// the rest doesn't make any sense for the "properties" dialog because the
Modified: trunk/M/src/gui/wxOptionsDlg.cpp
===================================================================
--- trunk/M/src/gui/wxOptionsDlg.cpp 2007-08-20 10:41:14 UTC (rev 7321)
+++ trunk/M/src/gui/wxOptionsDlg.cpp 2007-08-20 21:59:03 UTC (rev 7322)
@@ -626,7 +626,12 @@
wxOptionsNotebook(wxWindow *parent);
// the profile we use: just the global one here
- Profile *GetProfile() const { return mApplication->GetProfile(); }
+ Profile *GetProfile() const
+ {
+ Profile *profile = mApplication->GetProfile();
+ profile->IncRef();
+ return profile;
+ }
private:
Profile *m_profile;
@@ -752,7 +757,11 @@
}
protected:
- Profile *GetProfile() const { return m_profile; }
+ Profile *GetProfile() const
+ {
+ SafeIncRef(m_profile);
+ return m_profile;
+ }
private:
// the number and descriptions of the pages we show
@@ -4694,7 +4703,7 @@
wxOptionsNotebook::wxOptionsNotebook(wxWindow *parent)
: wxNotebookWithImages(_T("OptionsNotebook"), parent,
ms_aszImages)
{
- Profile *profile = GetProfile();
+ Profile_obj profile(GetProfile());
// create and add the pages
new wxOptionsPageIdent(this, profile);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates