Commit 2f48c626 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

Fix undefined behavior by calling on almost destroyed object

Because mView is in the process of being destroyed we shouldn't try to touch it too much.

Warning from ubsan:
    runtime error: member call on address 0x606000118e80 which does not
    point to an object of type 'QAbstractScrollArea'

Reviewed By: ngraham

Differential Revision: https://phabricator.kde.org/D28342
parent 24e88113
......@@ -119,7 +119,7 @@ struct PreviewItemDelegatePrivate
mutable ShadowCache mShadowCache;
PreviewItemDelegate* q;
ThumbnailView* mView;
QPointer<ThumbnailView> mView;
QWidget* mContextBar;
QToolButton* mSaveButton;
QPixmap mSaveButtonPixmap;
......@@ -663,6 +663,10 @@ QSize PreviewItemDelegate::sizeHint(const QStyleOptionViewItem & /*option*/, con
bool PreviewItemDelegate::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::Destroy || event->type() == QEvent::ChildRemoved || !d->mView) {
return QItemDelegate::eventFilter(object, event);
}
if (object == d->mView->viewport()) {
switch (event->type()) {
case QEvent::ToolTip:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment