Groot icon indicating copy to clipboard operation
Groot copied to clipboard

Segfault editing Conditions

Open SegfaultCreator opened this issue 5 years ago • 4 comments

Hello again,

Like my name suggests i created another Segfault :) Using the current (non-release) version of Groot, the editor crashes anytime i try to edit the Conditions in the palette (Actions are working well). Are there any suggestions about this issue?

(gdb) bt #0 0x000000000120bcf0 in () #1 0x00007ffff7b23c7d in CustomNodeDialog::checkValid() () at libbehavior_tree_editor.so #2 0x00007ffff7b259e7 in CustomNodeDialog::on_comboBox_currentIndexChanged(QString const&) () at libbehavior_tree_editor.so #3 0x00007ffff7b329fe in CustomNodeDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () at libbehavior_tree_editor.so #4 0x00007ffff7b32bf5 in CustomNodeDialog::qt_metacall(QMetaObject::Call, int, void**) () at libbehavior_tree_editor.so #5 0x00007ffff60ad619 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #6 0x00007ffff713ccb5 in QComboBox::currentIndexChanged(QString const&) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #7 0x00007ffff713eb4e in () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #8 0x00007ffff714002c in () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #9 0x00007ffff71402c1 in QComboBox::setCurrentIndex(int) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #10 0x00007ffff7b23776 in CustomNodeDialog::CustomNodeDialog(std::map<QString, NodeModel, std::less<QString>, std::allocator<std::pair<QString const, NodeModel> > > const&, QString, QWidget*) () at libbehavior_tree_editor.so

SegfaultCreator avatar Jun 03 '20 07:06 SegfaultCreator

thanks for reporting

facontidavide avatar Jun 03 '20 07:06 facontidavide

I just tested this and it seems to work fine on my machine. Any way I can reproduce this?

facontidavide avatar Jun 07 '20 10:06 facontidavide

Unfortunately, i dont have any idea to reproduce. QT Version is a bit higher (5.9.5).

Fortunatly, i managed to find out where the programm crashes:

void CustomNodeDialog::checkValid()
...
else if( _validator->validate(name, pos) != QValidator::Acceptable)

Through some debugging, i found out that the reason is, that

void CustomNodeDialog::on_comboBox_currentIndexChanged(const QString &node_type)
{
    auto shared_items = ui->tableWidget->findItems("__shared_blackboard", Qt::MatchExactly);
  ....
}

is only called, when the index changes, which is not the case, when an Action Node is selected. And for me, shared_items is an empty list.

What works for me is:

void CustomNodeDialog::on_comboBox_currentIndexChanged(const QString &node_type)
{
 .....
    if (!shared_items.empty())
        checkValid();
}

I would offer to create a pull request, but to be honest i don't now why this problem occurs, so i decided to first show what i found out.

BR

SegfaultCreator avatar Jun 08 '20 11:06 SegfaultCreator

Thanks but I am still struggling to reproduce this. If you tell me how, I will fix the error

facontidavide avatar Sep 20 '20 11:09 facontidavide