Pass this context object to the connect()

Otherwise when "this" instance
gets deleted and the sender still exists, the lambda
expression is still invoked for the deleted object.

Task-number: QTCREATORBUG-20223
Change-Id: Ifd5c9e6ce1fe7fde71698c6683cdfcd7566e8d35
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2018-04-06 15:57:30 +02:00
parent 18ad5653d5
commit e806ea40cc
4 changed files with 14 additions and 14 deletions

View File

@@ -44,7 +44,7 @@ DescriptionWidgetWatcher::DescriptionWidgetWatcher(DiffEditorController *control
m_widgets.append(widget);
}
connect(EditorManager::instance(), &EditorManager::editorOpened,
connect(EditorManager::instance(), &EditorManager::editorOpened, this,
[this](IEditor *editor) {
if (TextEditor::TextEditorWidget *widget = descriptionWidget(editor)) {
m_widgets.append(widget);
@@ -52,7 +52,7 @@ DescriptionWidgetWatcher::DescriptionWidgetWatcher(DiffEditorController *control
}
});
connect(EditorManager::instance(), &EditorManager::editorAboutToClose,
connect(EditorManager::instance(), &EditorManager::editorAboutToClose, this,
[this](IEditor *editor) {
if (TextEditor::TextEditorWidget *widget = descriptionWidget(editor)) {
emit descriptionWidgetRemoved(widget);