]> git.saurik.com Git - wxWidgets.git/commitdiff
Workaround for memory bug when using wxRegConfig and calling
authorJulian Smart <julian@anthemion.co.uk>
Fri, 10 Dec 2004 11:24:10 +0000 (11:24 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 10 Dec 2004 11:24:10 +0000 (11:24 +0000)
SetPath.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/config.cpp

index 30ca1fa2e7cdc0ad71715cf0cbf2b6fddbdd137c..f2d95677a4497c200be971ab2d89089f15b24a6c 100644 (file)
@@ -246,7 +246,19 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer,
     {
         // do change the path
         m_bChanged = true;
-        m_strOldPath = m_pContainer->GetPath();
+
+        /* JACS: work around a memory bug that causes an assert
+           when using wxRegConfig, related to reference-counting.
+           Can be reproduced by removing (const wxChar*) below and
+           adding the following code to the config sample OnInit under
+           Windows:
+
+           pConfig->SetPath(wxT("MySettings"));
+           pConfig->SetPath(wxT(".."));
+           int value;
+           pConfig->Read(_T("MainWindowX"), & value);
+        */
+        m_strOldPath = (const wxChar*) m_pContainer->GetPath();
         if ( *m_strOldPath.c_str() != wxCONFIG_PATH_SEPARATOR )
           m_strOldPath += wxCONFIG_PATH_SEPARATOR;
         m_pContainer->SetPath(strPath);