Android: Do not start Qt app if it has already been started
Call startQtApplication() in QtView even if the Qt libs have already been loaded, to make sure the app gets started also when the Activity is recreated. Check whether Qt app is already running inside the method itself to avoid hanging up because of trying to start it twice. Task-number: QTBUG-123711 Pick-to: 6.8 Change-Id: I3b009e4c2f40af9f258ce32b7e181c3faa21c194 Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit be33f2d3233fb787d5251ba7d0876962efe49075) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
35e027fb62
commit
fbc78ff287
@ -348,6 +348,9 @@ public class QtNative
|
||||
|
||||
static void startApplication(String params, String mainLib)
|
||||
{
|
||||
if (m_stateDetails.isStarted)
|
||||
return;
|
||||
|
||||
QtThread thread = getQtThread();
|
||||
thread.run(() -> {
|
||||
final String qtParams = mainLib + " " + params;
|
||||
|
@ -148,14 +148,14 @@ abstract class QtView extends ViewGroup {
|
||||
|
||||
loader.setMainLibraryName(appLibName);
|
||||
QtLoader.LoadingResult result = loader.loadQtLibraries();
|
||||
if (result == QtLoader.LoadingResult.Succeeded) {
|
||||
// Start Native Qt application
|
||||
m_viewInterface.startQtApplication(loader.getApplicationParameters(),
|
||||
loader.getMainLibraryPath());
|
||||
} else if (result == QtLoader.LoadingResult.Failed) {
|
||||
if (result == QtLoader.LoadingResult.Failed) {
|
||||
// If we weren't able to load the libraries, remove the delegate from the factory
|
||||
// as it's holding a reference to the Context, and we don't want it leaked
|
||||
QtEmbeddedViewInterfaceFactory.remove(getContext());
|
||||
} else {
|
||||
// Start Native Qt application
|
||||
m_viewInterface.startQtApplication(loader.getApplicationParameters(),
|
||||
loader.getMainLibraryPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user