From fb137ade7d93955a930ca9ba21f55dfd6b599f08 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 24 Mar 2016 11:03:25 +0100 Subject: Fix crash in VariableChooser fce83bd9f84883f93829e6ca9eacf098b018a02d in qtbase causes a crash: setModel creates a new selection model, which calls currentChanged, which accesses an uninitialized member. Hence, protect the access to it. Change-Id: I144f40aa4286f1a9edba24519a30c08ff5091f57 Reviewed-by: hjk --- src/plugins/coreplugin/variablechooser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/coreplugin/variablechooser.cpp') diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index 09aa1c8c4a..92b1caa7f7 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -245,7 +245,10 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent) : q(parent), m_lineEdit(0), m_textEdit(0), - m_plainTextEdit(0) + m_plainTextEdit(0), + m_iconButton(0), + m_variableTree(0), + m_variableDescription(0) { m_defaultDescription = VariableChooser::tr("Select a variable to insert."); @@ -408,7 +411,8 @@ void VariableChooser::addSupportForChildWidgets(QWidget *parent, MacroExpander * */ void VariableChooserPrivate::updateDescription(const QModelIndex &index) { - m_variableDescription->setText(m_model.data(index, Qt::ToolTipRole).toString()); + if (m_variableDescription) + m_variableDescription->setText(m_model.data(index, Qt::ToolTipRole).toString()); } /*! -- cgit v1.2.1