[vlc-devel] [PATCH 2/2] android: window: check jobj before creating window

Thomas Guillem thomas at gllm.fr
Fri Jan 22 14:31:22 UTC 2021



On Fri, Jan 22, 2021, at 15:02, Alexandre Janniaux wrote:
> To avoid creating a AWindowHandler without window.
> ---
>  modules/video_output/android/window.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/modules/video_output/android/window.c 
> b/modules/video_output/android/window.c
> index 0b8d0337ed..0f601e4af2 100644
> --- a/modules/video_output/android/window.c
> +++ b/modules/video_output/android/window.c
> @@ -90,6 +90,11 @@ static const struct vout_window_operations ops = {
>   */
>  static int Open(vout_window_t *wnd)
>  {
> +    /* We cannot create a window without the associated AWindow 
> instance. */
> +    jobject jobj = var_InheritAddress(wnd, "drawable-androidwindow");
> +    if (jobj == NULL)
> +        return VLC_EGENERIC;
> +
>      AWindowHandler *p_awh = AWindowHandler_new(VLC_OBJECT(wnd), wnd,
>          &(awh_events_t) { OnNewWindowSize, OnNewMouseCoords });
>      if (p_awh == NULL)

Maybe adding an extra argument to AWindowHandler_new() like a 'bool require_awindow' could be more clear. AWindowHandler_new() would return NULL is the variable is not found and require_awindow is true.

> -- 
> 2.30.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list