Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal 'getTextBeforeCursor on inactive InputConnection' error #11

Closed
stemuk opened this issue Jul 18, 2018 · 6 comments
Closed

Fatal 'getTextBeforeCursor on inactive InputConnection' error #11

stemuk opened this issue Jul 18, 2018 · 6 comments

Comments

@stemuk
Copy link

stemuk commented Jul 18, 2018

First of all, thanks a lot for this awesome project, I really appreciate the time and effort you must have put into zefyr to make this work!

In my own tests I ran into (only) one major issue that resolves around text input at a certain speed. If certain actions such as text input or or text deletion are preformed at a certain speed (for instance simply holding down the delete button on the keyboard) the entire application will crash and throw the following errors in frequent succession:

W/IInputConnectionWrapper( 5484): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5484): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5484): requestCursorAnchorInfo on inactive InputConnection

Even worse, the keybord will persist in its opened state even after the application has been closed by the user, as seen in this image, effectively rendering the device useless for several minutes.

The error might be caused by the race conditions you mentioned in #10 and seems to happen less frequently on more performant devices, which would suggest that performance optimizations might eliminate this issue for the most part.
Again, thanks a lot for creating this otherwise awesome widget, I think with the scope of this project issues like these are mostly unavoidable. 👍

@pulyaevskiy
Copy link
Contributor

pulyaevskiy commented Jul 18, 2018

Thanks for reporting!

This does sound like possibly caused by a race condition.

Could you provide some more details, which would help me to reproduce it on my end:

  1. Platform and device
  2. Example code
  3. A more detailed stack trace

You could also create a screen recording of the crash if it’s not too hard.

@pulyaevskiy
Copy link
Contributor

So far I've found two issues in Flutter repo which refer to the same error: flutter/flutter#10498 and flutter/flutter#11198

Looks strange.

@stemuk
Copy link
Author

stemuk commented Jul 18, 2018

The easiest way to reproduce the error is probably to spin up the zefyr example app on a local Android emulator and type or delete something quickly using the PC keyboard.
On my system the error occurs almost every time within a few seconds if I type or delete quickly enough. And while the error can be reproduced in release mode as well, it occurs much more frequently in slow mode which made me think that it is caused by a race condition.

@pulyaevskiy
Copy link
Contributor

Oh, right, it's very easy to reproduce.

I also checked regular Flutter TextField and it doesn't suffer from this issue.
See #12 which should address this issue.

While debugging I noticed that even for every caret position change there were at least 3-4 exchanges between Dart and native sides, that was definitely not expected.

I'll publish an update later today.

@pulyaevskiy
Copy link
Contributor

I just published 0.1.1 of zefyr package which should fix this issue. Please let me know how it goes for you!

@stemuk
Copy link
Author

stemuk commented Jul 19, 2018

Ok, thanks a lot for the fix! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants