Skip to content
Snippets Groups Projects
Commit 9ad4df13 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Fix crash in CPP Type Hierarchy


Fix crash happening when closing the editor containing a class that
is viewed in the Type Hierarchy.

Task-number: QTCREATORBUG-7327
Change-Id: I87298b7e0b271b9a5063d48999a37e8a0e78ba48
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@nokia.com>
parent bdb5b008
Branches
Tags
No related merge requests found
...@@ -95,8 +95,8 @@ namespace Internal { ...@@ -95,8 +95,8 @@ namespace Internal {
class CppClassLabel : public QLabel class CppClassLabel : public QLabel
{ {
public: public:
CppClassLabel(CPPEditorWidget *editor, QWidget *parent) CppClassLabel(QWidget *parent)
: QLabel(parent), m_editor(editor) : QLabel(parent)
{} {}
void setup(CppClass *cppClass) void setup(CppClass *cppClass)
...@@ -108,10 +108,15 @@ public: ...@@ -108,10 +108,15 @@ public:
private: private:
void mousePressEvent(QMouseEvent *) void mousePressEvent(QMouseEvent *)
{ {
m_editor->openLink(m_link); if (m_link.fileName.isEmpty())
return;
TextEditor::BaseTextEditorWidget::openEditorAt(m_link.fileName,
m_link.line,
m_link.column,
Constants::CPPEDITOR_ID);
} }
CPPEditorWidget *m_editor;
CPPEditorWidget::Link m_link; CPPEditorWidget::Link m_link;
}; };
...@@ -133,7 +138,7 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget(Core::IEditor *editor) : ...@@ -133,7 +138,7 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget(Core::IEditor *editor) :
if (CPPEditor *cppEditor = qobject_cast<CPPEditor *>(editor)) { if (CPPEditor *cppEditor = qobject_cast<CPPEditor *>(editor)) {
m_cppEditor = static_cast<CPPEditorWidget *>(cppEditor->widget()); m_cppEditor = static_cast<CPPEditorWidget *>(cppEditor->widget());
m_inspectedClass = new CppClassLabel(m_cppEditor, this); m_inspectedClass = new CppClassLabel(this);
m_inspectedClass->setMargin(5); m_inspectedClass->setMargin(5);
layout->addWidget(m_inspectedClass); layout->addWidget(m_inspectedClass);
m_model = new QStandardItemModel(this); m_model = new QStandardItemModel(this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment