diff options
| author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-01-13 13:14:35 +0100 |
|---|---|---|
| committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-01-13 13:18:26 +0100 |
| commit | 34cc807b36cff561d0ad89cb8fcb311a73611e71 (patch) | |
| tree | 507a5414294b73381f8c9f0814cdb94bdd30e2df /src/plugins/cpptools/cppcodecompletion.cpp | |
| parent | 669b56fde9e8f253626d719811cd552defe4c4bf (diff) | |
| download | qt-creator-34cc807b36cff561d0ad89cb8fcb311a73611e71.tar.gz | |
Fixed crash in function argument widget
It didn't make sure its Function* stayed valid. Now it does, by keeping
a copy of the list of CppDocuments (the snapshot) around.
Diffstat (limited to 'src/plugins/cpptools/cppcodecompletion.cpp')
| -rw-r--r-- | src/plugins/cpptools/cppcodecompletion.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 2cd859ecb9..a3759c7c95 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -77,7 +77,7 @@ namespace Internal { class FunctionArgumentWidget : public QLabel { public: FunctionArgumentWidget(Core::ICore *core); - void showFunctionHint(Function *functionSymbol); + void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot); protected: bool eventFilter(QObject *obj, QEvent *e); @@ -94,6 +94,7 @@ private: QFrame *m_popupFrame; Function *m_item; + Snapshot m_snapshot; }; class ConvertToCompletionItem: protected NameVisitor @@ -212,9 +213,11 @@ FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core) setMargin(1); } -void FunctionArgumentWidget::showFunctionHint(Function *functionSymbol) +void FunctionArgumentWidget::showFunctionHint(Function *functionSymbol, + const Snapshot &snapshot) { m_item = functionSymbol; + m_snapshot = snapshot; m_startpos = m_editor->position(); // update the text @@ -1023,7 +1026,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) QTC_ASSERT(function, return); m_functionArgumentWidget = new FunctionArgumentWidget(m_core); - m_functionArgumentWidget->showFunctionHint(function); + m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot()); } } else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) { QString toInsert = item.m_text; |
