diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-06-11 09:45:54 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-06-11 12:37:39 +0300 |
commit | daad8dcc08ab9e1d767b7d1fe1b033bda52602ff (patch) | |
tree | 382e3715c29529f12e8b4b27d2562d49b3fc2773 | |
parent | e6a34dad9594f3ae88736ca55cfada3d5f8e1819 (diff) |
viewer#1672 Crash at setDefaultFOV
Some things can make a copy of camera, like LLViewerWindow::cubeSnapshot
so need to store and clean up the connection
-rw-r--r-- | indra/newview/llviewercamera.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llviewercamera.h | 5 |
2 files changed, 13 insertions, 5 deletions
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 437f1239bf..bda1a20fdd 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -94,7 +94,13 @@ LLViewerCamera::LLViewerCamera() : LLCamera() mZoomSubregion = 1; mAverageSpeed = 0.f; mAverageAngularSpeed = 0.f; - gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2)); + + mCameraAngleChangedSignal = gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2)); +} + +LLViewerCamera::~LLViewerCamera() +{ + mCameraAngleChangedSignal.disconnect(); } void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVector3 &up_direction, const LLVector3 &point_of_interest) @@ -896,9 +902,8 @@ BOOL LLViewerCamera::isDefaultFOVChanged() } // static -void LLViewerCamera::updateCameraAngle( void* user_data, const LLSD& value) +void LLViewerCamera::updateCameraAngle(const LLSD& value) { - LLViewerCamera* self=(LLViewerCamera*)user_data; - self->setDefaultFOV(value.asReal()); + setDefaultFOV(value.asReal()); } diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 3bbb33f82c..8ac9101165 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -43,6 +43,7 @@ class alignas(16) LLViewerCamera : public LLCamera, public LLSimpleton<LLViewerC LL_ALIGN_NEW public: LLViewerCamera(); + ~LLViewerCamera(); typedef enum { @@ -65,7 +66,7 @@ public: const LLVector3 &point_of_interest); static void updateFrustumPlanes(LLCamera& camera, BOOL ortho = FALSE, BOOL zflip = FALSE, BOOL no_hacks = FALSE); - static void updateCameraAngle(void* user_data, const LLSD& value); + void updateCameraAngle(const LLSD& value); void setPerspective(BOOL for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, BOOL limit_select_distance, F32 z_near = 0, F32 z_far = 0); const LLMatrix4 &getProjection() const; @@ -125,6 +126,8 @@ protected: F32 mZoomFactor; S16 mZoomSubregion; + boost::signals2::connection mCameraAngleChangedSignal; + public: }; |