Alexandre Julliard : wineandroid: Hold on to the native window until we get a new one.
Alexandre Julliard
julliard at winehq.org
Thu Jul 13 14:41:34 CDT 2017
Module: wine
Branch: master
Commit: 44ee3bf85a51be5aa664dadecd290b9be0ab012c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=44ee3bf85a51be5aa664dadecd290b9be0ab012c
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jul 13 17:22:37 2017 +0200
wineandroid: Hold on to the native window until we get a new one.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wineandroid.drv/WineActivity.java | 16 +++++++++++++---
dlls/wineandroid.drv/device.c | 2 ++
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/wineandroid.drv/WineActivity.java b/dlls/wineandroid.drv/WineActivity.java
index d1fe305..5a99e07 100644
--- a/dlls/wineandroid.drv/WineActivity.java
+++ b/dlls/wineandroid.drv/WineActivity.java
@@ -311,6 +311,8 @@ public class WineActivity extends Activity
protected WineWindow parent;
protected Surface window_surface;
protected Surface client_surface;
+ protected SurfaceTexture window_surftex;
+ protected SurfaceTexture client_surftex;
protected WineWindowGroup window_group;
protected WineWindowGroup client_group;
@@ -442,14 +444,22 @@ public class WineActivity extends Activity
if (is_client)
{
if (surftex == null) client_surface = null;
- else if (client_surface == null) client_surface = new Surface( surftex );
+ else if (surftex != client_surftex)
+ {
+ client_surftex = surftex;
+ client_surface = new Surface( surftex );
+ }
Log.i( LOGTAG, String.format( "set client surface hwnd %08x %s", hwnd, client_surface ));
wine_surface_changed( hwnd, client_surface, true );
}
else
{
if (surftex == null) window_surface = null;
- else if (window_surface == null) window_surface = new Surface( surftex );
+ else if (surftex != window_surftex)
+ {
+ window_surftex = surftex;
+ window_surface = new Surface( surftex );
+ }
Log.i( LOGTAG, String.format( "set window surface hwnd %08x %s", hwnd, window_surface ));
wine_surface_changed( hwnd, window_surface, false );
}
@@ -567,7 +577,7 @@ public class WineActivity extends Activity
Log.i( LOGTAG, String.format( "onSurfaceTextureDestroyed win %08x %s",
window.hwnd, is_client ? "client" : "whole" ));
window.set_surface( null, is_client );
- return true;
+ return false; // hold on to the texture since the app may still be using it
}
public void onSurfaceTextureUpdated(SurfaceTexture surftex)
diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c
index 3911d21..0ccae11 100644
--- a/dlls/wineandroid.drv/device.c
+++ b/dlls/wineandroid.drv/device.c
@@ -463,6 +463,8 @@ static void CALLBACK register_native_window_callback( ULONG_PTR arg1, ULONG_PTR
BOOL opengl = arg3;
struct native_win_data *data = get_native_win_data( hwnd, opengl );
+ if (!win) return; /* do nothing and hold on to the window until we get a new surface */
+
if (!data || data->parent == win)
{
if (win) pANativeWindow_release( win );
More information about the wine-cvs
mailing list