[server] Fix possible crash on creation of DataDevice

Authored by graesslin on Oct 24 2016, 9:05 AM.

Description

[server] Fix possible crash on creation of DataDevice

Summary:
This is a similar condition as D3148. If a DataDeviceInterface is
created for the currently focused keyboard Surface the current selection
is sent to the new DataDeviceInterface. If the current selection does
not have a DataSourceInterface a DataOfferInterface for a null
DataSourceInterface would be created and result in a crash.

This change verifies that there is a DataSourcInterface on the current
selection prior to sending out the selection.

Test Plan:
A test case is added which simulates the condition by
using two clients.

Reviewers: Plasma on Wayland

Subscribers: plasma-devel

Tags: Plasma on Wayland

Differential Revision: https://phabricator.kde.org/D3149