wayland/xdg-shell: Move popup role assignment behind checks

Merged Robert Mader requested to merge rmader/mutter:xdg_popup_checks into master

If we returned early in one of the checks but already assigned the surface role, we'd later run into a double-free and crash. Just do the checks at the beginning.

Also, the check introduced in commit 88ff196f missed a return.

Merge request reports