From 453fe67d74ace81cd1b85fb24bb84b292492e6f7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 22 Aug 2013 11:50:17 +0200 Subject: fix use of dynamically allocated OUString after my change in ea5cba1f88a4e183b135ee8df72fae9c0ee32aa6, the code is passing in the address of a local OUString member, then later delete'ing that pointer. Change it to pass in new instance of OUString Change-Id: I9ae5876464fc0dcb74fbd152fd3f96cf856688c8 --- svtools/source/contnr/templwin.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'svtools') diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 8acdca15ee24..c9f86042fc18 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -186,7 +186,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : OUString aEntryStr = SVT_RESSTR(STR_SVT_NEWDOC); SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.InsertEntry( aEntryStr, aImage, ICON_POS_NEWDOC ); - pEntry->SetUserData( &aNewDocumentRootURL ); + pEntry->SetUserData( new OUString(aNewDocumentRootURL) ); pEntry->SetQuickHelpText( SVT_RESSTR(STR_SVT_NEWDOC_HELP) ); DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); long nTemp = pEntry->GetBoundRect().GetSize().Width(); @@ -199,7 +199,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : aEntryStr = SVT_RESSTR(STR_SVT_TEMPLATES); pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_TEMPLATES ) ), ICON_POS_TEMPLATES ); - pEntry->SetUserData( &aTemplateRootURL ); + pEntry->SetUserData( new OUString(aTemplateRootURL) ); pEntry->SetQuickHelpText(SVT_RESSTR(STR_SVT_TEMPLATES_HELP)); DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); nTemp = pEntry->GetBoundRect().GetSize().Width(); @@ -211,7 +211,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : aEntryStr = SVT_RESSTR(STR_SVT_MYDOCS); pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_MYDOCS ) ), ICON_POS_MYDOCS ); - pEntry->SetUserData( &aMyDocumentsRootURL ); + pEntry->SetUserData( new OUString(aMyDocumentsRootURL) ); pEntry->SetQuickHelpText( SVT_RESSTR(STR_SVT_MYDOCS_HELP) ); DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); nTemp = pEntry->GetBoundRect().GetSize().Width(); @@ -222,7 +222,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : aEntryStr = SVT_RESSTR(STR_SVT_SAMPLES); pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_SAMPLES ) ), ICON_POS_SAMPLES ); - pEntry->SetUserData( &aSamplesFolderRootURL ); + pEntry->SetUserData( new OUString(aSamplesFolderRootURL) ); pEntry->SetQuickHelpText( SVT_RESSTR(STR_SVT_SAMPLES_HELP)); DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); nTemp = pEntry->GetBoundRect().GetSize().Width(); @@ -247,8 +247,8 @@ SvxIconChoiceCtrlEntry* SvtIconWindow_Impl::GetEntry( const OUString& rURL ) con for ( sal_uLong i = 0; i < aIconCtrl.GetEntryCount(); ++i ) { SvxIconChoiceCtrlEntry* pTemp = aIconCtrl.GetEntry( i ); - OUString aURL( *( (OUString*)pTemp->GetUserData() ) ); - if ( aURL == rURL ) + OUString *pURL = (OUString*)pTemp->GetUserData(); + if ( (*pURL) == rURL ) { pEntry = pTemp; break; -- cgit