forked from qt-creator/qt-creator
ProjectExplorer: Fix possible use-after-free in Project combobox
Make sure the combobox values are set to null. Otherwise the ComboBoxItem might try to read from that value while it is being removed from the model. Task-number: QTCREATORBUG-17223 Change-Id: I6588aaddf39736846878593a8e6844dab96de408 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -347,7 +347,7 @@ public:
|
|||||||
|
|
||||||
QVariant data(int column, int role) const final
|
QVariant data(int column, int role) const final
|
||||||
{
|
{
|
||||||
return m_projectItem->data(column, role);
|
return m_projectItem ? m_projectItem->data(column, role) : QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectItem *m_projectItem;
|
ProjectItem *m_projectItem;
|
||||||
@@ -413,6 +413,7 @@ public:
|
|||||||
if (item->m_projectItem->parent())
|
if (item->m_projectItem->parent())
|
||||||
m_projectsModel.takeItem(item->m_projectItem);
|
m_projectsModel.takeItem(item->m_projectItem);
|
||||||
delete item->m_projectItem;
|
delete item->m_projectItem;
|
||||||
|
item->m_projectItem = nullptr;
|
||||||
m_comboBoxModel.destroyItem(item);
|
m_comboBoxModel.destroyItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user