Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions rviz_common/src/rviz_common/properties/property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <QApplication> // NOLINT: cpplint is unable to handle the include order here
#include <QPalette> // NOLINT: cpplint is unable to handle the include order here
#include <QLineEdit> // NOLINT: cpplint is unable to handle the include order here
#include <QPointer> // NOLINT: cpplint is unable to handle the include order here
#include <QSpinBox> // NOLINT: cpplint is unable to handle the include order here
#include <QString> // NOLINT: cpplint is unable to handle the include order here
#include <QTimer> // NOLINT: cpplint is unable to handle the include order here
Expand Down Expand Up @@ -386,10 +387,12 @@ void Property::setModel(PropertyTreeModel * model)
{
model_ = model;
if (model_ && hidden_) {
// process propertyHiddenChanged after insertion into model has finishedAdd commentMore actions
QTimer::singleShot(0, model_, [this]() {
if (model_) {
model_->emitPropertyHiddenChanged(this);
// process propertyHiddenChanged after insertion into model has finished
// Use QPointer to track Property lifetime and avoid use-after-free
QPointer<Property> self = this;
QTimer::singleShot(0, model_, [self]() {
if (self && self->model_) {
self->model_->emitPropertyHiddenChanged(self);
}
});
}
Expand Down