Skip to content

Commit

Permalink
Merge pull request #153 from horriblename/fix/segfault
Browse files Browse the repository at this point in the history
fix: segfault
  • Loading branch information
horriblename committed Aug 25, 2024
2 parents d0033c9 + 676e6df commit 427690a
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/GestureManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void GestureManager::sendCancelEventsToWindows() {

for (const auto& touch : this->touchedResources.all()) {
const auto t = touch.lock();
if (t.impl_) { // FIXME: idk how to check weak pointer validity
if (t.get()) {
t->sendCancel();
}
}
Expand Down Expand Up @@ -366,16 +366,23 @@ bool GestureManager::onTouchUp(ITouch::SUpEvent ev) {
if (**SEND_CANCEL) {
const auto surface = g_pInputManager->m_sTouchData.touchFocusSurface;

if (!surface.valid()) {
return true;
}

wl_client* client = surface.get()->client();
if (client) {
SP<CWLSeatResource> seat = g_pSeatManager->seatResourceForClient(client);
if (!client) {
return true;
}

if (seat) {
auto touches = seat.get()->touches;
for (const auto& touch : touches) {
this->touchedResources.remove(touch);
}
}
SP<CWLSeatResource> seat = g_pSeatManager->seatResourceForClient(client);
if (!seat.get()) {
return true;
}

auto touches = seat.get()->touches;
for (const auto& touch : touches) {
this->touchedResources.remove(touch);
}

return BLOCK;
Expand Down

0 comments on commit 427690a

Please sign in to comment.