Skip to content

Crash on Wayland #478

@johnnyggalt

Description

@johnnyggalt

Running under Wayland on Fedora 43 Kinoite (whether inside a toolbox or on the host), I get a crash after clicking the close button on a webview:

$ ~/repository/repro_desktop_webview_window_crash/build/linux/x64/release/bundle/repro_desktop_webview_window_crash
Gdk-Message: 15:02:50.433: Unable to load  from the cursor theme
Gdk-Message: 15:02:53.301: Unable to load  from the cursor theme
~WebviewWindow
embedder.cc (2603): 'FlutterEngineRemoveView' returned 'kInvalidArguments'. Remove view info was invalid. The implicit view cannot be removed.

(com.example.repro_desktop_webview_window_crash:1299103): Gdk-WARNING **: 15:02:56.612: eglMakeCurrent failed

(com.example.repro_desktop_webview_window_crash:1299103): Gdk-WARNING **: 15:02:56.612: eglMakeCurrent failed

(com.example.repro_desktop_webview_window_crash:1299103): Gdk-WARNING **: 15:02:56.616: eglMakeCurrent failed

(com.example.repro_desktop_webview_window_crash:1299103): Gdk-WARNING **: 15:02:56.616: eglMakeCurrent failed

(com.example.repro_desktop_webview_window_crash:1299103): Gdk-WARNING **: 15:02:56.618: eglMakeCurrent failed
Segmentation fault         (core dumped) ~/repository/repro_desktop_webview_window_crash/build/linux/x64/release/bundle/repro_desktop_webview_window_crash

Reproduce Steps

$ mkdir repro_desktop_webview_window_crash
$ cd repro_desktop_webview_window_crash
$ flutter create --platforms linux .
$ flutter pub add desktop_webview_window

Then change main.dart to:

import 'package:flutter/material.dart';
import 'package:desktop_webview_window/desktop_webview_window.dart';

void main(args) {
  if (runWebViewTitleBarWidget(args)) {
    return;
  }

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Repro',
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Repro'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: .center,
          children: [
            ElevatedButton(
                onPressed: () async {
                    final webview = await WebviewWindow.create();
                    webview.launch("https://example.com");
                },
                child: const Text('Open Webview'),
            ),
          ],
        ),
      ),
    );
  }
}
$ flutter build linux
$ ./build/linux/x64/release/bundle/repro_desktop_webview_window_crash

Click the Open Webview button, then click the close button on the webview.

Expected behavior

Should simply close the webview without crashing.

Additional Info

Version (please complete the following information):

  • Flutter Version: 3.44.0-0.3.pre (but also tried on latest stable, 3.41.1)
  • OS: Fedora Kinoite 43
  • plugin: desktop_webview_window: 0.2.3

Note that in my actual application I can run under X11 by prepending the start command with GDK_BACKEND=x11 and it works fine in that case. However, I was surprised to find that the repro above also fails under X11:

$ GDK_BACKEND=x11 ./build/linux/x64/release/bundle/repro_desktop_webview_window_crash 3
Gtk-Message: 15:14:50.431: Failed to load module "colorreload-gtk-module"

** (com.example.repro_desktop_webview_window_crash:1319133): WARNING **: 15:14:52.054: Failed to setup compositor shaders, unable to make OpenGL context current
~WebviewWindow
embedder.cc (2603): 'FlutterEngineRemoveView' returned 'kInvalidArguments'. Remove view info was invalid. The implicit view cannot be removed.

(com.example.repro_desktop_webview_window_crash:1319133): Gdk-WARNING **: 15:14:54.011: The program 'com.example.repro_desktop_webview_window_crash' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 1618 error_code 10 request_code 150 (GLX) minor_code 26)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions