From e0ec5f6b5d4b06042c51501c20fb6f6a1c5d4f0d Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Thu, 9 May 2024 21:08:27 +0200 Subject: [PATCH] Fix #1825 model_ is destroyed between registration of the single-shot timer and its execution --- src/rviz/properties/property.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rviz/properties/property.cpp b/src/rviz/properties/property.cpp index 526441a2d..df0fb7433 100644 --- a/src/rviz/properties/property.cpp +++ b/src/rviz/properties/property.cpp @@ -397,7 +397,10 @@ void Property::setModel(PropertyTreeModel* model) if (model_ && hidden_) { // process propertyHiddenChanged after insertion into model has finished - QTimer::singleShot(0, model_, [this]() { model_->emitPropertyHiddenChanged(this); }); + QTimer::singleShot(0, model_, [this]() { + if (model_) + model_->emitPropertyHiddenChanged(this); + }); } int num_children = numChildren(); for (int i = 0; i < num_children; i++)