diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-01-06 13:22:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-01-06 13:22:26 +0100 |
commit | fd6263e37641657f8bf81f42e72c7074263d277d (patch) | |
tree | e8378e9e8d7890499c7097daf324e289039469ac /sd | |
parent | cd103a888b8149aca66c7a93b91f8f7c2f1dbe31 (diff) |
Make E3dScene3D::GetCamera return non-reference
I stumbled over this when Valgrind'ing CppunitTest_sd_filters_test somewhat
erroneously reported
Source and destination overlap in memcpy(0x2fde4af8, 0x2fde4af8, 96)
for
aCamera = rNewCamera;
in E3dScene::SetCamera (svx/source/engine3d/scene3d.cxx), where the compiler
chose to use memcpy in the implicit definition of the Viewport3D (being a base
class of Camera3D) copy assignment operator, and the call pattern of
Get/SetCamera in EnhancedCustomShape3d::Create3DObject
(svx/source/customshapes/EnhancedCustomShape3d.cxx) causes that assignment to be
a self-assignment.
Upon closer inspection, some calls of GetCamera already create a copy from the
returned reference, while others modified the returned reference, but then would
also always call SetCamera on it. An alternative to the given change would have
been to instead change SetCamera(Camera3D&) to UpdateCamera() and require all
call sites of GetCamera/UpdateCamera to modify the reference returned from
GetCamera, but it looks safer overall to go this way.
Change-Id: I578e72db57630dca1b09124a3b11d177005b797d
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/func/fucon3d.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sd/source/ui/func/fucon3d.cxx b/sd/source/ui/func/fucon3d.cxx index 0c27ad0381c3..702d1bd0a106 100644 --- a/sd/source/ui/func/fucon3d.cxx +++ b/sd/source/ui/func/fucon3d.cxx @@ -238,7 +238,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() void FuConstruct3dObject::ImpPrepareBasic3DShape(E3dCompoundObject* p3DObj, E3dScene *pScene) { - Camera3D &aCamera = (Camera3D&) pScene->GetCamera (); + Camera3D aCamera = pScene->GetCamera (); // get transformed BoundVolume of the new object basegfx::B3DRange aBoundVol; |