Skip to content

AppLifecycleListener.onExitRequested never fires on Windows after pdfrxFlutterInitialize() #682

Description

@Markus43

Summary

On Windows, once pdfrxFlutterInitialize() has run, closing the window with the title-bar X no
longer triggers AppLifecycleListener.onExitRequested, so apps can't run graceful shutdown. It
happens from init alone, before any PDF is rendered, and reproduces on the latest versions.

Environment

pdfrx 2.4.7, pdfrx_engine 0.4.6, Flutter 3.44.7 (stable), Windows 10.

Repro

  1. Windows desktop app that registers:
    AppLifecycleListener(onExitRequested: () async {
      debugPrint('FIRED');
      return AppExitResponse.exit;
    });
  2. Close with the X → prints FIRED.
  3. Add await pdfrxFlutterInitialize(); in main(), run again, close with the X.

Expected: still prints FIRED. Actual: never prints; the app just exits.

Note

After pdfrxFlutterInitialize(), the process owns an extra hidden top-level window
(GDI+ Hook Window Class); removing the init call removes the window and restores
onExitRequested. This appears to defeat the Windows engine's last-window exit check.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions