From 12c8741704c0e905b42451dc48733ac18d078138 Mon Sep 17 00:00:00 2001 From: Matthew Griffin <45285214+matthew-griffin@users.noreply.github.com> Date: Mon, 3 Jun 2019 10:58:56 +0100 Subject: [PATCH] Fix crash on Linux --- include/wx/qt/private/treeitemdelegate.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/wx/qt/private/treeitemdelegate.h b/include/wx/qt/private/treeitemdelegate.h index a2fc222e02..af5f939381 100644 --- a/include/wx/qt/private/treeitemdelegate.h +++ b/include/wx/qt/private/treeitemdelegate.h @@ -12,6 +12,7 @@ #include +#include "wx/app.h" #include "wx/textctrl.h" #include "treeitemfactory.h" @@ -35,9 +36,12 @@ public: void destroyEditor(QWidget *WXUNUSED(editor), const QModelIndex &WXUNUSED(index)) const wxOVERRIDE { - m_current_model_index = QModelIndex(); - delete m_textCtrl; - m_textCtrl = NULL; + if (!wxTheApp->IsScheduledForDestruction(m_textCtrl)) + { + m_current_model_index = QModelIndex(); + wxTheApp->ScheduleForDestruction(m_textCtrl); + m_textCtrl = NULL; + } } void setModelData(QWidget *WXUNUSED(editor), QAbstractItemModel *WXUNUSED(model), const QModelIndex &WXUNUSED(index)) const wxOVERRIDE