Commit b2d648df authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

datadevice: do not call a null dragSource

Fixes the following backtrace:
*0  KWaylandServer::DataDeviceInterface::dragSource() const (this=0x0)
at ./src/server/datadevice_interface.cpp:199
*1  0x00007f10d67b0c71 in
KWaylandServer::DataDeviceInterface::updateDragTarget(KWaylandServer::SurfaceInterface*,
unsigned int) (this=0x55c42e3ee9a0,
surface=surface@entry=0x55c42e4b3170, serial=serial@entry=3104)
    at ./src/server/datadevice_interface.cpp:278
*2  0x00007f10d67d8e52 in
KWaylandServer::SeatInterface::setDragTarget(KWaylandServer::SurfaceInterface*,
QPointF const&, QMatrix4x4 const&)
(this=this@entry=0x55c42d422ed0, surface=0x55c42e4b3170,
globalPosition=..., inputTransformation=...) at
/usr/include/c++/9/bits/atomic_base.h:413
*3  0x00007f10d67d9209 in
KWaylandServer::SeatInterface::setDragTarget(KWaylandServer::SurfaceInterface*,
QMatrix4x4 const&) (this=this@entry=0x55c42d422ed0, surface=<optimized
out>, inputTransformation=...)
    at ./src/server/seat_interface.cpp:578
*4  0x000055c42cb4563a in KWin::Xwl::XToWlDrag::setDragTarget()
(this=this@entry=0x55c42ea07a00) at ./src/toplevel.h:990
*5  0x000055c42cb47a68 in KWin::Xwl::XToWlDrag::offerCallback(QString
const&) (mime=..., this=0x55c42ea07a00) at ./src/xwl/drag_x.cpp:242
*6  KWin::Xwl::XToWlDrag::offerCallback(QString const&)
(this=0x55c42ea07a00, mime=...) at ./src/xwl/drag_x.cpp:237
*7  0x00007f10d5dc06fe in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
parent 3905cfe3
......@@ -264,8 +264,9 @@ void DataDeviceInterface::updateDragTarget(SurfaceInterface *surface, quint32 se
}
// don't update serial, we need it
}
if (!surface) {
if (auto s = d->seat->dragSource()->dragSource()) {
auto dragSourceDevice = d->seat->dragSource();
if (!surface || !dragSourceDevice) {
if (auto s = dragSourceDevice->dragSource()) {
s->dndAction(DataDeviceManagerInterface::DnDAction::None);
}
return;
......@@ -275,7 +276,7 @@ void DataDeviceInterface::updateDragTarget(SurfaceInterface *surface, quint32 se
// TODO: do this for all client's surfaces?
return;
}
auto *source = d->seat->dragSource()->dragSource();
auto *source = dragSourceDevice->dragSource();
if (source) {
source->setAccepted(false);
}
......
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