summaryrefslogtreecommitdiff
path: root/include/svx/scene3d.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-01-06 13:22:26 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-01-06 13:22:26 +0100
commitfd6263e37641657f8bf81f42e72c7074263d277d (patch)
treee8378e9e8d7890499c7097daf324e289039469ac /include/svx/scene3d.hxx
parentcd103a888b8149aca66c7a93b91f8f7c2f1dbe31 (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 'include/svx/scene3d.hxx')
-rw-r--r--include/svx/scene3d.hxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx
index f8642e02b540..70d77e8373f8 100644
--- a/include/svx/scene3d.hxx
+++ b/include/svx/scene3d.hxx
@@ -126,7 +126,7 @@ public:
virtual E3dScene* GetScene() const override;
void SetCamera(const Camera3D& rNewCamera);
- const Camera3D& GetCamera() const { return aCamera; }
+ Camera3D GetCamera() const { return aCamera; }
void removeAllNonSelectedObjects();
virtual E3dScene* Clone() const override;