diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2012-04-20 12:01:01 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2012-04-20 13:17:51 +0200 |
commit | 9ad4df1382b861ded0c64af623a83292b48bc9ef (patch) | |
tree | b2fee56283d700b78c61f8442cf5416a8447444a /src/plugins/cppeditor/cpptypehierarchy.cpp | |
parent | bdb5b008aab1cf5f31aea8d9838c2289ae504471 (diff) |
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: Eike Ziller <eike.ziller@nokia.com>
Reviewed-by: David Schulz <david.schulz@nokia.com>
Diffstat (limited to 'src/plugins/cppeditor/cpptypehierarchy.cpp')
-rw-r--r-- | src/plugins/cppeditor/cpptypehierarchy.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/cppeditor/cpptypehierarchy.cpp b/src/plugins/cppeditor/cpptypehierarchy.cpp index 886c369856..66f7da9061 100644 --- a/src/plugins/cppeditor/cpptypehierarchy.cpp +++ b/src/plugins/cppeditor/cpptypehierarchy.cpp @@ -95,8 +95,8 @@ namespace Internal { class CppClassLabel : public QLabel { public: - CppClassLabel(CPPEditorWidget *editor, QWidget *parent) - : QLabel(parent), m_editor(editor) + CppClassLabel(QWidget *parent) + : QLabel(parent) {} void setup(CppClass *cppClass) @@ -108,10 +108,15 @@ public: private: 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; }; @@ -133,7 +138,7 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget(Core::IEditor *editor) : if (CPPEditor *cppEditor = qobject_cast<CPPEditor *>(editor)) { m_cppEditor = static_cast<CPPEditorWidget *>(cppEditor->widget()); - m_inspectedClass = new CppClassLabel(m_cppEditor, this); + m_inspectedClass = new CppClassLabel(this); m_inspectedClass->setMargin(5); layout->addWidget(m_inspectedClass); m_model = new QStandardItemModel(this); |