On Thursday, October 13, 2016 01:12:27 PM Martin Graesslin wrote:
> Just an example of an issue I run into today:
> https://git.reviewboard.kde.org/ r/129171/
> Application just crashed on startup due to a missing nullptr check exposed
> by a different windowing systems.
This intrigued me, so I went looking at the Qt docs
(e.g.http://doc.qt.io/qt-5/qguiapplication.html#clipboard) to see if they
said anything about the returned pointers:
Returns the object for interacting with the clipboard.
const QMimeData *QClipboard::mimeData(Mode mode = Clipboard) const
Returns a reference to a QMimeData representation of the current clipboard
Neither function's documentation says it can return a nullptr; neither says it
can't. But what really surprises me in the documentation is the use of the
words "object" and "reference" here. Since that's not what those functions are
returning, and certainly the use of the word "reference" suggests to me (when
somewhat-wrongly applied to a pointer) "can't be null".
So to a very limited extent we can claim it's the documentation's fault.