https://bugs.kde.org/show_bug.cgi?id=524685

            Bug ID: 524685
           Summary: Krita crashes on Wayland when switching tablet pen to
                    eraser while Straight Line Tool is active
    Classification: Applications
           Product: krita
      Version First unspecified
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Tablets (tablet issues are only very rarely bugs in
                    Krita!)
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 195431
  --> https://bugs.kde.org/attachment.cgi?id=195431&action=edit
gdb backtrace

## Summary

Krita 6.0.3 reproducibly crashes under native Wayland when I activate the
physical eraser function on my drawing tablet while the Straight Line Tool is
active.

The crash does not occur when Krita is run through XWayland using
`QT_QPA_PLATFORM=xcb`, although eraser behavior is less consistent there.

## Steps to reproduce

1. Launch Krita normally under native Wayland.
2. Open or create a document.
3. Select the Straight Line Tool.
4. Use the drawing tablet pen's physical eraser function/button.
5. Krita crashes with SIGSEGV.

This is reproducible for me.

## Expected result

The stylus should switch to eraser mode and allow the Straight Line Tool to
erase without crashing.

## Actual result

Krita immediately crashes with SIGSEGV while Qt is processing a
`TabletLeaveProximity` event.

The relevant portion of the backtrace is:

```text
#0  std::__lower_bound(...)
#1  std::lower_bound(...)
#2  QFlatMap<...>::lower_bound(...)
#3  QFlatMap<...>::lower_bound(...)
#4  QFlatMap<...>::try_emplace(...)
#5  QPointingDevicePrivate::pointById(this=0x7ffff4819c18 <main_arena+344>,
id=0)
#6  QSinglePointEvent::QSinglePointEvent(... type=QEvent::TabletLeaveProximity
...)
#7  QTabletEvent::QTabletEvent(...)
#8  QGuiApplicationPrivate::processTabletLeaveProximityEvent(...)
#9  QWindowSystemInterface::sendWindowSystemEvents(...)
```

`QPointingDevicePrivate::pointById()` appears to receive an invalid/stale
private pointer. I have attached the complete `thread apply all bt full`
output.

## Environment

* OS: Arch Linux
* Desktop/compositor: Hyprland
* Session: Wayland
* Krita: 6.0.3-2
* Qt: qt6-base 6.11.2-2

## XWayland comparison

Launching Krita with:

```bash
env QT_QPA_PLATFORM=xcb krita
```

prevents the crash using the same reproduction steps.

The physical eraser behaves somewhat inconsistently under XWayland, but Krita
does not segfault.

This appears to be specific to the native Wayland tablet/proximity event path.

## Additional information

The tablet eraser is activated using the physical control on the pen, rather
than Krita's `E` keyboard shortcut.

I can provide additional tablet/input logs if needed.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to