From a1d60803f23a34d8eef40d1b3d1d0757e30f87d1 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 11 Apr 2022 12:05:00 +0200 Subject: [PATCH] avoid crash with vnc plugin --- src/inputpanel/QskInputContext.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/inputpanel/QskInputContext.cpp b/src/inputpanel/QskInputContext.cpp index 236c191f..ba99590b 100644 --- a/src/inputpanel/QskInputContext.cpp +++ b/src/inputpanel/QskInputContext.cpp @@ -183,13 +183,12 @@ static QPointer< QskInputContext > qskInputContext; static void qskSendToPlatformContext( QEvent::Type type ) { - const auto platformInputContext = - QGuiApplicationPrivate::platformIntegration()->inputContext(); + const auto integration = QGuiApplicationPrivate::platformIntegration(); - if ( platformInputContext ) + if ( const auto inputContext = integration->inputContext() ) { QEvent event( type ); - QCoreApplication::sendEvent( platformInputContext, &event ); + QCoreApplication::sendEvent( inputContext, &event ); } } @@ -208,9 +207,12 @@ void QskInputContext::setInstance( QskInputContext* inputContext ) qskInputContext = inputContext; if ( oldContext && oldContext->parent() == nullptr ) + { delete oldContext; - qskSendToPlatformContext( QEvent::PlatformPanel ); + // still needed with > Qt 5.15 ? + qskSendToPlatformContext( QEvent::PlatformPanel ); + } } }