diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-02-29 22:34:51 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-03-01 05:34:49 +0000 |
commit | 63a480aac59d459e9f759c5a346bebdda0c78acd (patch) | |
tree | 2acde9e67c8b526b5b67cb366bf5a3d191c529ef | |
parent | 33e530692e5527f3286547647604cbcd2e410b82 (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)
Signed-off-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index c82b5fe33f19..e6ed8a6f369f 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1310,6 +1310,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() ) { |