go-flutter-desktop / go-flutter

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
https://hover.build/
BSD 3-Clause "New" or "Revised" License
5.88k stars 283 forks source link

An exception is logged when maximizing the window vertically #198

Closed StefanLobbenmeier closed 5 years ago

StefanLobbenmeier commented 5 years ago

Is not an urgent issue, as I can see no effect besides that the error is logged. Might indicate other problems though, so thats why I created the issue

Flutter version

Flutter 1.7.8+hotfix.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b712a172f9 (8 days ago) • 2019-07-09 13:14:38 -0700
Engine • revision 54ad777fd2
Tools • Dart 2.4.0

Golang errors (Optional)

Compilation works, but runtime error (occurs in pairs as far as I can see, thats why I copied both):

[ERROR:c:\b\s\w\ir\k\src\flutter\lib\ui\ui_dart_state.cc(148)] Unhandled Exception: 'package:flutter/src/gestures/converter.da
rt': Failed assertion: line 251 pos 20: 'state.down': is not true.
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:40:39)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2      PointerEventConverter.expand (package:flutter/src/gestures/converter.dart:251:20)
#3      _SyncIterator.moveNext (dart:core-patch/core_patch.dart:152:12)
#4      ListQueue.addAll (dart:collection/queue.dart:655:25)
#5      _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:
84:27)
#6      _rootRunUnary (dart:async/zone.dart:1136:13)
#7      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#8      _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#9      _invoke1 (dart:ui/hooks.dart:250:10)
#10     _dispatchPointerDataPacket (dart:ui/hooks.dart:159:5)

[ERROR:c:\b\s\w\ir\k\src\flutter\lib\ui\ui_dart_state.cc(148)] Unhandled Exception: 'package:flutter/src/gestures/converter.da
rt': Failed assertion: line 251 pos 20: 'state.down': is not true.
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:40:39)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2      PointerEventConverter.expand (package:flutter/src/gestures/converter.dart:251:20)
#3      _SyncIterator.moveNext (dart:core-patch/core_patch.dart:152:12)
#4      ListQueue.addAll (dart:collection/queue.dart:655:25)
#5      _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:
84:27)
#6      _rootRunUnary (dart:async/zone.dart:1136:13)
#7      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#8      _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#9      _invoke1 (dart:ui/hooks.dart:250:10)
#10     _dispatchPointerDataPacket (dart:ui/hooks.dart:159:5)

Steps to Reproduce

  1. My code looks like this
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: FutureWrapper<List<Entry>>(
        classifications,
        (context, _entry) => ListView(
              children: _entry
                  .map((entry) => ListEntry(entry))
                  .toList(),
            ),
        key: Key("List of Entries"),
      ),
    );
  2. I run it with hover run on Windows
  3. When doubleclick on the bottom edge (to maximize in the vertical direction), this exception occurs
pchampio commented 5 years ago

This also happen a lot to me. The Steps to reproduce are correct.

GeertJohan commented 5 years ago

This also happens when clicking inside the app (mouse button down), then dragging the cursor out of the app window.

pchampio commented 5 years ago

I also get another error:

(embedder._Ctype_struct___1) {
 struct_size: (embedder._Ctype_ulong) 80,
 phase: (embedder._Ctype_FlutterPointerPhase) 4,
 timestamp: (embedder._Ctype_ulong) 1563482087786,
 x: (embedder._Ctype_double) 655,
 y: (embedder._Ctype_double) 635,
 device: (embedder._Ctype_int) 0,
 signal_kind: (embedder._Ctype_FlutterPointerSignalKind) 0,
 scroll_delta_x: (embedder._Ctype_double) 0,
 scroll_delta_y: (embedder._Ctype_double) 0,
 device_kind: (embedder._Ctype_FlutterPointerDeviceKind) 1,
 buttons: (embedder._Ctype_long) 0
}
flutter: Observatory listening on http://127.0.0.1:50300/D76EqACWb7U=/
go-flutter: no handler found for channel flutter/isolate
(embedder._Ctype_struct___1) {
 struct_size: (embedder._Ctype_ulong) 80,
 phase: (embedder._Ctype_FlutterPointerPhase) 5,
 timestamp: (embedder._Ctype_ulong) 1563482088034,
 x: (embedder._Ctype_double) 801,
 y: (embedder._Ctype_double) 1021,
 device: (embedder._Ctype_int) 0,
 signal_kind: (embedder._Ctype_FlutterPointerSignalKind) 0,
 scroll_delta_x: (embedder._Ctype_double) 0,
 scroll_delta_y: (embedder._Ctype_double) 0,
 device_kind: (embedder._Ctype_FlutterPointerDeviceKind) 1,
 buttons: (embedder._Ctype_long) 0
}
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: 'package:flutter/src/gestures/converter.dart': Failed assertion: line 359 pos 20: '_pointers.containsKey(datum.device)': is not true.
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:40:39)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2      PointerEventConverter.expand (package:flutter/src/gestures/converter.dart:359:20)
#3      _SyncIterator.moveNext (dart:core-patch/core_patch.dart:144:12)
#4      ListQueue.addAll (dart:collection/queue.dart:655:25)
#5      _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:84:27)
#6      _rootRunUnary (dart:async/zone.dart:1136:13)
#7      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#8      _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#9      _invoke1 (dart:ui/hooks.dart:250:10)
#10     _dispatchPointerDataPacket (dart:ui/hooks.dart:159:5)

Syncing files to device Flutter test device...                   1 231ms

This happen when I resize the application right after the window is created. I can reproduce the error quite constantly, just have fast very fast!

weirdly enough, adding a glfw.WaitEvent() before setting CursorPosCallback solves 'my' issue glfw.WaitEvent()

pchampio commented 5 years ago

I have written:

    // flutter's PlatformMessage handler is registered through the dart:ui.Window
    // interface. ui.Window must have at least paint one frame, before any
    // platfrom message can be corectly handled by ui.Window.onPlatformMessage.

it's only based on MY understanding, the comment is certainly false.

The comment is meant to be for Flutter foundation BindingBase window onPointerDataPacket but I think it also apply to platfrom messages.

@GeertJohan what do you think about a4f132c7a77a, should we keep it? should we remove it and keep the error message (which quite frankly doesn't happen that frequently, I mean WHO is resizing the window in the first 100ms)?

GeertJohan commented 5 years ago

Everyone with a tiling window manager will automatically resize the window right after it has been created. Will WaitEvent always return imediatly? Or could this block the app startup?

edit: misclick closed issue

pchampio commented 5 years ago

glfw.WaitEvents() will not necessary return immediately. But it's fine, because a we need to wait for a engine's paint event.

This will not block the app startup, at some point, paint event will occur. Just to clarify, glfw.WaitEventsTimeout(0.016) was used because embedder.FlutterEngineFlushPendingTasksNow() isn't connected to the GLFW event loop.

The end goal with the custom engine event loop interop is to only use glfw.WaitEvents().