summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-02-29 22:34:51 +0100
committerMichael Stahl <mstahl@redhat.com>2012-02-29 22:35:09 +0100
commit0c6d89941118368ccbb596362a545db5d3a07dbe (patch)
tree5a05fb0f50ca7d3ab1c35df9363aa28f016f795e
parentab29d941b39da12b3711b21e680aebcf5b7c9a09 (diff)
fdo#46340: fix crash in SdrGrafObj::getInputStream:
Add the ridiculous hack that used to be here (and distributed across various GetDocumentStream methods to make it non-obvious) that makes this not crash by accident. (regression from fd95f1ab6220c6a530fd2e4e727417f504a5db51)
-rw-r--r--svx/source/svdraw/svdograf.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 23f81dffadc1..6fd9cf3f21c8 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -1335,6 +1335,14 @@ Reference< XInputStream > SdrGrafObj::getInputStream()
::comphelper::LifecycleProxy proxy;
xStream.set(
pModel->GetDocumentStream(pGraphic->GetUserData(), proxy));
+ // fdo#46340: this may look completely insane, and it is,
+ // but it also prevents a crash: the LifecycleProxy will go out
+ // of scope, but the xStream must be returned; the UcbStreamHelper
+ // will actually copy the xStream to a temp file (because it is
+ // not seekable), which makes it not crash...
+ SvStream *const pStream =
+ utl::UcbStreamHelper::CreateStream(xStream);
+ xStream.set(new utl::OInputStreamWrapper(pStream, true));
}
else if( pGraphic && GetGraphic().IsLink() )
{