DRM event handling robustness fixes

The first patch is a minor cleanup that fell out of working on this. The second patch was the first attempt to fix the bug referenced in the last patch. It didn't fix that bug, but does address an issue that could cause trouble as well.

Merge request reports