wineandroid: Hold on to the native window until we get a new one.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-07-13 17:22:37 +02:00
parent 83bed85074
commit 44ee3bf85a
2 changed files with 15 additions and 3 deletions

View file

@ -311,6 +311,8 @@ protected class WineWindow extends Object
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 void set_surface( SurfaceTexture surftex, boolean is_client )
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 boolean onSurfaceTextureDestroyed( SurfaceTexture surftex )
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)

View file

@ -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 );