diff --git a/rviz_common/src/rviz_common/properties/property_tree_widget.cpp b/rviz_common/src/rviz_common/properties/property_tree_widget.cpp index 3f6632e5e..4bbbc1d62 100644 --- a/rviz_common/src/rviz_common/properties/property_tree_widget.cpp +++ b/rviz_common/src/rviz_common/properties/property_tree_widget.cpp @@ -103,7 +103,7 @@ void PropertyTreeWidget::setModel(PropertyTreeModel * model) if (model_) { connect( model_, SIGNAL(propertyHiddenChanged(const Property*)), - this, SLOT(propertyHiddenChanged(const Property*)), Qt::QueuedConnection); + this, SLOT(propertyHiddenChanged(const Property*)), Qt::DirectConnection); connect( model_, SIGNAL(expand(const QModelIndex&)), this, SLOT(expand(const QModelIndex&))); @@ -119,12 +119,14 @@ void PropertyTreeWidget::setModel(PropertyTreeModel * model) void PropertyTreeWidget::propertyHiddenChanged(const Property * property) { if (model_) { - const auto & parent_index = model_->parentIndex(property); - if (parent_index.isValid()) { - setRowHidden(property->rowNumberInParent(), parent_index, property->getHidden()); - } else { - printf("Trying to hide property '%s' that is not part of the model.\n", - qPrintable(property->getName())); + if (property->parent() != nullptr) { + const auto & parent_index = model_->parentIndex(property); + if (parent_index.isValid()) { + setRowHidden(property->rowNumberInParent(), parent_index, property->getHidden()); + } else { + printf("Trying to hide property '%s' that is not part of the model.\n", + qPrintable(property->getName())); + } } } }