Android: runAction can now be run past queue
On vulkan implementation it was possible that when going background destroySurface was queued and then run when coming back foreground that caused vulkan not being able to draw. Fixes: QTBUG-118985 Fixes: QTBUG-118840 Change-Id: I5957b74b89384ea84fc09d9b55afcccf5c82e390 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit b2c648c57261550474308aee09bfc1054818fb60) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
69c68571db
commit
793a568ebc
@ -268,16 +268,26 @@ public class QtNative
|
||||
// Post a runnable to Main (UI) Thread if the app is active,
|
||||
// otherwise, queue it to be posted when the the app is active again
|
||||
public static void runAction(Runnable action)
|
||||
{
|
||||
runAction(action, true);
|
||||
}
|
||||
|
||||
public static void runAction(Runnable action, boolean queueWhenInactive)
|
||||
{
|
||||
synchronized (m_mainActivityMutex) {
|
||||
final Looper mainLooper = Looper.getMainLooper();
|
||||
final Handler handler = new Handler(mainLooper);
|
||||
final boolean isStateVisible =
|
||||
(m_stateDetails.state != ApplicationState.ApplicationSuspended)
|
||||
&& (m_stateDetails.state != ApplicationState.ApplicationHidden);
|
||||
final boolean active = (isActivityValid() && isStateVisible) || isServiceValid();
|
||||
if (!active || !handler.post(action))
|
||||
m_lostActions.add(action);
|
||||
|
||||
if (queueWhenInactive) {
|
||||
final boolean isStateVisible =
|
||||
(m_stateDetails.state != ApplicationState.ApplicationSuspended)
|
||||
&& (m_stateDetails.state != ApplicationState.ApplicationHidden);
|
||||
final boolean active = (isActivityValid() && isStateVisible) || isServiceValid();
|
||||
if (!active || !handler.post(action))
|
||||
m_lostActions.add(action);
|
||||
} else {
|
||||
handler.post(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,8 +122,8 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
||||
if (m_surfaceContainer != null) {
|
||||
removeView(m_surfaceContainer);
|
||||
m_surfaceContainer = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
public void setGeometry(final int x, final int y, final int w, final int h)
|
||||
|
Loading…
x
Reference in New Issue
Block a user