Bug 419722

Summary: QMimeData::hasText() called on nullptr returned by QClipboard::mimeData().
Product: [Applications] kdiff3 Reporter: edy.burt
Component: applicationAssignee: michael <reeves.87>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 1.8.x   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 1.8.3
Sentry Crash Report:

Description edy.burt 2020-04-06 14:13:22 UTC
SUMMARY
On some platforms (e.g. `-platform vnc`), `QClipboard::mimeData` will return `nullptr` (according to https://doc.qt.io/qt-5/qclipboard.html#mimeData and observed in practice).

STEPS TO REPRODUCE
1. Run `kdiff3 -platform vnc`.

OBSERVED RESULT
Segmentation fault.

EXPECTED RESULT
Application starting (and serving VNC on port 5900).

SOFTWARE/OS VERSIONS
KDE Frameworks Version: 5.66.0
Qt Version: 5.12.7

ADDITIONAL INFORMATION
Likely introduced by https://invent.kde.org/kde/kdiff3/-/commit/d7507c80bb87cbd5010a4b2301ec7511ff77f2b4.
Simplest fix (not tested) seems like it would be replacing:
    if(mimeData->hasText())
with:
    if(mimeData && mimeData->hasText())
Comment 1 michael 2020-04-30 22:42:09 UTC
Git commit 48c0deaf53eb5c8ab60deabfa59551c8bcca5612 by Michael Reeves, on behalf of Christoph Feck.
Committed on 30/04/2020 at 22:38.
Pushed by mreeves into branch 'master'.

Fix crash when clipboard is not available

Summary:
QClipboard::mimeData() can be nullptr according to documentation.
FIXED-IN: 1.8.3

Reviewers: mreeves

Reviewed By: mreeves

Differential Revision: https://phabricator.kde.org/D29248

M  +1    -1    src/pdiff.cpp

https://invent.kde.org/kde/kdiff3/commit/48c0deaf53eb5c8ab60deabfa59551c8bcca5612
Comment 2 michael 2020-04-30 22:44:59 UTC
Git commit 643edc26bcc8f8e083a97e87c2686f62ffd01f31 by Michael Reeves, on behalf of Christoph Feck.
Committed on 30/04/2020 at 22:44.
Pushed by mreeves into branch '1.8'.

Fix crash when clipboard is not available

Summary:
QClipboard::mimeData() can be nullptr according to documentation.
FIXED-IN: 1.8.3

Reviewers: mreeves

Reviewed By: mreeves

Differential Revision: https://phabricator.kde.org/D29248

M  +1    -1    src/pdiff.cpp

https://invent.kde.org/kde/kdiff3/commit/643edc26bcc8f8e083a97e87c2686f62ffd01f31