Commit 914ac120 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark Committed by Kurt Hindenburg
Browse files

Fix invalid call on destroyed object

Part of !209
parent 9d75f9ed
......@@ -35,10 +35,14 @@ CompositeWidgetFocusWatcher::CompositeWidgetFocusWatcher(QWidget *compositeWidge
bool CompositeWidgetFocusWatcher::eventFilter(QObject *watched, QEvent *event)
auto *focusEvent = static_cast<QFocusEvent *>(event);
switch(event->type()) {
case QEvent::Close:
case QEvent::DeferredDelete:
case QEvent::Destroy:
disconnect(this, &CompositeWidgetFocusWatcher::compositeFocusChanged, watched, nullptr);
case QEvent::FocusIn:
emit compositeFocusChanged(true);
......@@ -577,7 +577,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
new AutoScrollHandler(this);
// Keep this last
auto focusWatcher = new CompositeWidgetFocusWatcher(this, this);
CompositeWidgetFocusWatcher *focusWatcher = new CompositeWidgetFocusWatcher(this, this);
connect(focusWatcher, &CompositeWidgetFocusWatcher::compositeFocusChanged,
this, [this](bool focused) {_hasCompositeFocus = focused;});
connect(focusWatcher, &CompositeWidgetFocusWatcher::compositeFocusChanged,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment