Bug 455241

Summary: Crash after assigning "one finger drag" to zoom and rotate canvas
Product: [Applications] krita Reporter: Alvin Wong <alvin>
Component: Shortcuts and Canvas Input SettingsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: halla
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: crash backtrace

Description Alvin Wong 2022-06-14 11:08:57 UTC
Created attachment 149674 [details]
crash backtrace

SUMMARY



STEPS TO REPRODUCE
1. Assign "One Finger Drag" gesture to "Zoom and Rotate Canvas" (Discrete Rotate Mode) in Canvas Input Settings
2. Perform one finger drag gesture on canvas

OBSERVED RESULT
Crash

EXPECTED RESULT
At least it shouldn't crash

SOFTWARE/OS VERSIONS
Windows: Windows 10
Comment 1 Halla Rempt 2022-06-15 09:02:42 UTC
Since the KisZoomAndRotate::inputEvent hardcodes for two touch points, it's logical that there'll be a crash if there's only one of them:

        const QPointF p0 = tevent->touchPoints().at(0).pos();
        const QPointF p1 = tevent->touchPoints().at(1).pos();

I'm not sure what we should do here, ignore the event if there's only one touchpoint or make sure this setting is impossible.
Comment 2 Halla Rempt 2022-06-24 09:10:11 UTC
Git commit 0a3a0148c9b107668e378b4113bbaae28df871ce by Halla Rempt.
Committed on 24/06/2022 at 09:09.
Pushed by rempt into branch 'master'.

Check the size of the touchpoints array before indexing

M  +20   -18   libs/ui/input/kis_zoom_and_rotate_action.cpp

https://invent.kde.org/graphics/krita/commit/0a3a0148c9b107668e378b4113bbaae28df871ce
Comment 3 Halla Rempt 2022-06-24 09:10:26 UTC
Git commit 85faf731616931baed7ec48ccfb84a266d96a625 by Halla Rempt.
Committed on 24/06/2022 at 09:10.
Pushed by rempt into branch 'krita/5.1'.

Check the size of the touchpoints array before indexing
(cherry picked from commit 0a3a0148c9b107668e378b4113bbaae28df871ce)

M  +20   -18   libs/ui/input/kis_zoom_and_rotate_action.cpp

https://invent.kde.org/graphics/krita/commit/85faf731616931baed7ec48ccfb84a266d96a625