Gui: try to fix property editor crash
Crash stack trace https://forum.freecadweb.org/viewtopic.php?f=8&t=37757&e=1&view=unread#p327901 It appears to by caused by handling QAbstractItemDelegate::closeEditor signal twice. Once inside PropertyItemDelegate::editorClosed via slot connection where the editor is closed/destroyed, the other in PropertyEditor::closeEditor() which tries to access the destroyed editor. This patch removes handling of closeEditor signal in PropertyItemDelegate.
This commit is contained in:
@@ -153,7 +153,6 @@ void PropertyEditor::commitData (QWidget * editor)
|
||||
|
||||
void PropertyEditor::editorDestroyed (QObject * editor)
|
||||
{
|
||||
delegate->editorClosed(0,QAbstractItemDelegate::NoHint);
|
||||
QTreeView::editorDestroyed(editor);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,6 @@ PropertyItemDelegate::PropertyItemDelegate(QObject* parent)
|
||||
: QItemDelegate(parent), expressionEditor(0)
|
||||
, pressed(false), changed(false)
|
||||
{
|
||||
connect(this, SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),
|
||||
this, SLOT(editorClosed(QWidget*, QAbstractItemDelegate::EndEditHint)));
|
||||
}
|
||||
|
||||
PropertyItemDelegate::~PropertyItemDelegate()
|
||||
@@ -123,26 +121,6 @@ bool PropertyItemDelegate::editorEvent (QEvent * event, QAbstractItemModel* mode
|
||||
return QItemDelegate::editorEvent(event, model, option, index);
|
||||
}
|
||||
|
||||
void PropertyItemDelegate::editorClosed(QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
|
||||
{
|
||||
#if 0
|
||||
int id = 0;
|
||||
auto &app = App::GetApplication();
|
||||
const char *name = app.getActiveTransaction(&id);
|
||||
if(id && id==activeTransactionID) {
|
||||
FC_LOG("editor close transaction " << name);
|
||||
app.closeActiveTransaction(false,id);
|
||||
activeTransactionID = 0;
|
||||
}
|
||||
FC_LOG("editor close " << editor);
|
||||
#endif
|
||||
|
||||
// don't close the editor when pressing Tab or Shift+Tab
|
||||
// https://forum.freecadweb.org/viewtopic.php?f=3&t=34627#p290957
|
||||
if (editor && hint != EditNextItem && hint != EditPreviousItem)
|
||||
editor->close();
|
||||
}
|
||||
|
||||
QWidget * PropertyItemDelegate::createEditor (QWidget * parent, const QStyleOptionViewItem & /*option*/,
|
||||
const QModelIndex & index ) const
|
||||
{
|
||||
|
||||
@@ -47,7 +47,6 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
void valueChanged();
|
||||
void editorClosed (QWidget * editor, QAbstractItemDelegate::EndEditHint hint);
|
||||
|
||||
private:
|
||||
mutable QWidget *expressionEditor;
|
||||
|
||||
Reference in New Issue
Block a user