Commit bd7acc0e authored by David Edmundson's avatar David Edmundson
Browse files

Guard data source being deleted before processing dataoffer receive event

Summary:
A data source can disappear at any moment, it's plausible a client could
have requested data whilst the client was alive and we are processing it
afterwards.

The accept and finish callback guard against the source being deleted,
but recieve did not.

BUG: 400311

Test Plan: Could still copy/paste as before

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16431
parent 96967485
......@@ -24,6 +24,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QStringList>
// Wayland
#include <wayland-server.h>
// system
#include <unistd.h>
namespace KWayland
{
......@@ -69,6 +71,10 @@ void DataOfferInterface::Private::receiveCallback(wl_client *client, wl_resource
void DataOfferInterface::Private::receive(const QString &mimeType, qint32 fd)
{
if (!source) {
close(fd);
return;
}
source->requestData(mimeType, fd);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment