summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-02-07 16:37:11 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2012-02-07 16:17:17 +0100
commit39aacb4dd11b6745a32d4404cee207c047177b07 (patch)
tree6b8029d0cdecf67dbe19454ba8ca270f75c9ccf3 /src/compositor/wayland_wrapper
parent083ece74feedb93c0ed208017658c85a4bb1e532 (diff)
Fix data device handling.
Clearing the device list on resource destroy is wrong: it cleans away data devices for all clients. Calling free when removing stale devices for a client is also wrong. Change-Id: I7bfcc928762dc4ca7dbf5abeebcd2489956e6828 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r--src/compositor/wayland_wrapper/wlinputdevice.cpp10
-rw-r--r--src/compositor/wayland_wrapper/wlinputdevice.h3
2 files changed, 10 insertions, 3 deletions
diff --git a/src/compositor/wayland_wrapper/wlinputdevice.cpp b/src/compositor/wayland_wrapper/wlinputdevice.cpp
index f908fe41e..fd08624b6 100644
--- a/src/compositor/wayland_wrapper/wlinputdevice.cpp
+++ b/src/compositor/wayland_wrapper/wlinputdevice.cpp
@@ -220,17 +220,21 @@ void InputDevice::setMouseFocus(Surface *surface, const QPoint &globalPos, const
localPos.x(), localPos.y());
}
-void InputDevice::clientRequestedDataDevice(DataDeviceManager *data_device_manager, struct wl_client *client, uint32_t id)
+void InputDevice::cleanupDataDeviceForClient(struct wl_client *client)
{
for (int i = 0; i < m_data_devices.size(); i++) {
struct wl_resource *data_device_resource =
m_data_devices.at(i)->dataDeviceResource();
if (data_device_resource->client == client) {
m_data_devices.removeAt(i);
- free(data_device_resource);
break;
}
}
+}
+
+void InputDevice::clientRequestedDataDevice(DataDeviceManager *data_device_manager, struct wl_client *client, uint32_t id)
+{
+ cleanupDataDeviceForClient(client);
DataDevice *dataDevice = new DataDevice(data_device_manager,client,id);
m_data_devices.append(dataDevice);
}
@@ -328,7 +332,7 @@ void InputDevice::destroy_resource(wl_resource *resource)
input_device->base()->pointer_focus_resource = 0;
}
- input_device->m_data_devices.clear();
+ input_device->cleanupDataDeviceForClient(resource->client);
wl_list_remove(&resource->link);
diff --git a/src/compositor/wayland_wrapper/wlinputdevice.h b/src/compositor/wayland_wrapper/wlinputdevice.h
index ac105d56d..05980b669 100644
--- a/src/compositor/wayland_wrapper/wlinputdevice.h
+++ b/src/compositor/wayland_wrapper/wlinputdevice.h
@@ -89,7 +89,10 @@ public:
Compositor *compositor() const;
WaylandInputDevice *handle() const;
+
private:
+ void cleanupDataDeviceForClient(struct wl_client *client);
+
WaylandInputDevice *m_handle;
Compositor *m_compositor;
QList<DataDevice *>m_data_devices;