summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorMatthew J. Francis <mjay.francis@gmail.com>2014-09-20 12:14:41 +0800
committerNoel Grandin <noelgrandin@gmail.com>2014-09-22 05:15:53 +0000
commit764e3016b62665281539af4e990ca4ff0445c26c (patch)
treef5ec6b10fa76e3f622d26095981e5c1a92c2485f /sfx2/source
parent935e8fc98c033680029e4531747a2f680f50d5ca (diff)
fdo#84086 Fix assorted use-after-free bugs
Change-Id: Iec004fffdb0afbe27bd69f379db90f6d904a8a65 Reviewed-on: https://gerrit.libreoffice.org/11553 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/control/shell.cxx2
-rw-r--r--sfx2/source/sidebar/Deck.cxx12
2 files changed, 7 insertions, 7 deletions
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 808c0b439a3f..983f36e83b3c 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -585,7 +585,7 @@ void SfxShell::SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::em
pNewSlot->fnExec = SFX_STUB_PTR(SfxShell,VerbExec);
pNewSlot->fnState = SFX_STUB_PTR(SfxShell,VerbState);
pNewSlot->pType = 0; // HACK(SFX_TYPE(SfxVoidItem)) ???
- pNewSlot->pName = OUStringToOString( aVerbs[n].VerbName, RTL_TEXTENCODING_UTF8 ).getStr();
+ pNewSlot->pName = strdup (OUStringToOString( aVerbs[n].VerbName, RTL_TEXTENCODING_UTF8 ).getStr());
pNewSlot->pLinkedSlot = 0;
pNewSlot->nArgDefCount = 0;
pNewSlot->pFirstArgDef = 0;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 63e24dbe95b1..f08173a9ecc9 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -291,17 +291,17 @@ void Deck::ShowPanel (const Panel& rPanel)
-const char* GetWindowClassification (const Window* pWindow)
+const OUString& GetWindowClassification (const Window* pWindow)
{
const OUString& rsName (pWindow->GetText());
if (!rsName.isEmpty())
{
- return ::rtl::OUStringToOString(rsName, RTL_TEXTENCODING_ASCII_US).getStr();
+ return rsName;
}
else
{
- static const char msWindow[] = "window";
- return msWindow;
+ static const OUString aWindow ("window");
+ return aWindow;
}
}
@@ -311,12 +311,12 @@ void Deck::PrintWindowSubTree (Window* pRoot, int nIndentation)
static const char* sIndentation = " ";
const Point aLocation (pRoot->GetPosPixel());
const Size aSize (pRoot->GetSizePixel());
- const char* sClassification = GetWindowClassification(pRoot);
+ OUString sClassification = GetWindowClassification(pRoot);
const char* sVisible = pRoot->IsVisible() ? "visible" : "hidden";
OSL_TRACE("%s%x %s %s +%d+%d x%dx%d",
sIndentation+strlen(sIndentation)-nIndentation*4,
pRoot,
- sClassification,
+ OUStringToOString(sClassification, RTL_TEXTENCODING_ASCII_US).getStr(),
sVisible,
aLocation.X(),aLocation.Y(),
aSize.Width(),aSize.Height());