Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix component inspector shutdown crash #724

Merged
merged 3 commits into from
Apr 5, 2021
Merged
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
30 changes: 30 additions & 0 deletions src/gui/plugins/component_inspector/ComponentInspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ using namespace gazebo;
template<>
void ignition::gazebo::setData(QStandardItem *_item, const math::Pose3d &_data)
{
if (nullptr == _item)
return;

_item->setData(QString("Pose3d"),
ComponentsModel::RoleNames().key("dataType"));
_item->setData(QList({
Expand All @@ -122,6 +125,9 @@ void ignition::gazebo::setData(QStandardItem *_item, const math::Pose3d &_data)
template<>
void ignition::gazebo::setData(QStandardItem *_item, const msgs::Light &_data)
{
if (nullptr == _item)
return;

int lightType = -1;
if (_data.type() == msgs::Light::POINT)
{
Expand Down Expand Up @@ -168,6 +174,9 @@ template<>
void ignition::gazebo::setData(QStandardItem *_item,
const math::Vector3d &_data)
{
if (nullptr == _item)
return;

_item->setData(QString("Vector3d"),
ComponentsModel::RoleNames().key("dataType"));
_item->setData(QList({
Expand All @@ -181,6 +190,9 @@ void ignition::gazebo::setData(QStandardItem *_item,
template<>
void ignition::gazebo::setData(QStandardItem *_item, const std::string &_data)
{
if (nullptr == _item)
return;

_item->setData(QString("String"),
ComponentsModel::RoleNames().key("dataType"));
_item->setData(QString::fromStdString(_data),
Expand All @@ -192,6 +204,9 @@ template<>
void ignition::gazebo::setData(QStandardItem *_item,
const std::ostringstream &_data)
{
if (nullptr == _item)
return;

_item->setData(QString("Raw"),
ComponentsModel::RoleNames().key("dataType"));
_item->setData(QString::fromStdString(_data.str()),
Expand All @@ -202,6 +217,9 @@ void ignition::gazebo::setData(QStandardItem *_item,
template<>
void ignition::gazebo::setData(QStandardItem *_item, const bool &_data)
{
if (nullptr == _item)
return;

_item->setData(QString("Boolean"),
ComponentsModel::RoleNames().key("dataType"));
_item->setData(_data, ComponentsModel::RoleNames().key("data"));
Expand All @@ -211,6 +229,9 @@ void ignition::gazebo::setData(QStandardItem *_item, const bool &_data)
template<>
void ignition::gazebo::setData(QStandardItem *_item, const int &_data)
{
if (nullptr == _item)
return;

_item->setData(QString("Integer"),
ComponentsModel::RoleNames().key("dataType"));
_item->setData(_data, ComponentsModel::RoleNames().key("data"));
Expand All @@ -220,6 +241,9 @@ void ignition::gazebo::setData(QStandardItem *_item, const int &_data)
template<>
void ignition::gazebo::setData(QStandardItem *_item, const double &_data)
{
if (nullptr == _item)
return;

_item->setData(QString("Float"),
ComponentsModel::RoleNames().key("dataType"));
_item->setData(_data, ComponentsModel::RoleNames().key("data"));
Expand All @@ -229,6 +253,9 @@ void ignition::gazebo::setData(QStandardItem *_item, const double &_data)
template<>
void ignition::gazebo::setData(QStandardItem *_item, const sdf::Physics &_data)
{
if (nullptr == _item)
return;

_item->setData(QString("Physics"),
ComponentsModel::RoleNames().key("dataType"));
_item->setData(QList({
Expand All @@ -240,6 +267,9 @@ void ignition::gazebo::setData(QStandardItem *_item, const sdf::Physics &_data)
//////////////////////////////////////////////////
void ignition::gazebo::setUnit(QStandardItem *_item, const std::string &_unit)
{
if (nullptr == _item)
return;

_item->setData(QString::fromStdString(_unit),
ComponentsModel::RoleNames().key("unit"));
}
Expand Down