diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 7d994f4394..7aeb3b9ca6 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -248,6 +248,7 @@ @implementation QIOSViewController { BOOL m_updatingProperties; QMetaObject::Connection m_focusWindowChangeConnection; + QMetaObject::Connection m_appStateChangedConnection; } #ifndef Q_OS_TVOS @@ -276,7 +277,7 @@ }); QIOSApplicationState *applicationState = &QIOSIntegration::instance()->applicationState; - QObject::connect(applicationState, &QIOSApplicationState::applicationStateDidChange, + m_appStateChangedConnection = QObject::connect(applicationState, &QIOSApplicationState::applicationStateDidChange, [self](Qt::ApplicationState oldState, Qt::ApplicationState newState) { if (oldState == Qt::ApplicationSuspended && newState != Qt::ApplicationSuspended) { // We may have ignored an earlier layout because the application was suspended, @@ -296,6 +297,7 @@ - (void)dealloc { QObject::disconnect(m_focusWindowChangeConnection); + QObject::disconnect(m_appStateChangedConnection); [super dealloc]; }