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 e9249c766..038051310 100644 --- a/rviz_common/src/rviz_common/properties/property_tree_widget.cpp +++ b/rviz_common/src/rviz_common/properties/property_tree_widget.cpp @@ -101,7 +101,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&))); @@ -117,13 +117,15 @@ 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())); + } } } }