It can happen that the visualParent has no window attached, so don't access it. In this case, use the visualParent's geometry.
It can happen that the visualParent has no window attached, so don't access it. In this case, use the visualParent's geometry.