Validate surface is valid when sending TextInput leave event
ClosedPublic

Authored by davidedmundson on May 4 2017, 10:40 PM.

Details

Summary

It's possible for the surface to be unbound when we send the leave
event; we've called Resource::unbind() of Surface, so the Surface has,
deleteLater called, but it's still a valid object, and the first check
passes.

We get in this situation because when a surface is destroyed, we're
handling text input from the same source event.

Sending a nullpointer is a protocol error, and wayland kindly closes the
connection.

This fixes my constant:
"Did the Wayland server die" error messages when running clients.

Test Plan

Got errors after setting up qt virtual keyboard.
Had reproducible case.
Restarted kwin after this patch, now doesn't crash.

Diff Detail

Repository
R127 KWayland
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
davidedmundson created this revision.May 4 2017, 10:40 PM
Restricted Application added projects: Plasma on Wayland, Frameworks. · View Herald TranscriptMay 4 2017, 10:40 PM
Restricted Application added subscribers: Frameworks, plasma-devel. · View Herald Transcript
graesslin requested changes to this revision.May 5 2017, 5:31 AM
graesslin added a subscriber: graesslin.

Please add a unit test case.

This revision now requires changes to proceed.May 5 2017, 5:31 AM
apol added a subscriber: apol.May 5 2017, 8:49 AM

+1
FWIW, this fixes my initial issue.

davidedmundson edited edge metadata.

Also validate the enterEvent, this makes it symetric to pointer enter/leave
events that have the same check.

I've also added a test case.

Restricted Application edited projects, added Plasma; removed Plasma on Wayland. · View Herald TranscriptMay 5 2017, 2:54 PM
graesslin accepted this revision.May 5 2017, 4:44 PM

Thanks for adding the test!

This revision is now accepted and ready to land.May 5 2017, 4:44 PM
This revision was automatically updated to reflect the committed changes.