forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user