Skip to content

Commit

Permalink
fix: crash at drawStandardIcon/isTabBarToolButton
Browse files Browse the repository at this point in the history
Change-Id: I44d0904858933021b269a04011d5945aa4fb0962
  • Loading branch information
zccrs committed Jan 8, 2018
1 parent 6049831 commit 45a305f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dstyleplugin/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,9 @@ void Style::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,

bool Style::isTabBarToolButton(const QWidget *button) const
{
if (Q_UNLIKELY(!button))
return false;

if (Q_UNLIKELY(qobject_cast<QTabBar*>(button->parent())
#ifdef DTKWIDGET_CLASS_DTabBar
|| qobject_cast<DTabBar*>(button->parent())
Expand Down Expand Up @@ -1221,7 +1224,7 @@ void Style::drawStandardIcon(QStyle::StandardPixmap sp, const QStyleOption *opt,
else if (hasFocus)
mode = QIcon::Selected;

QPixmap pixmap = standardIcon(sp, opt, widget).pixmap(widget->window()->windowHandle(),
QPixmap pixmap = standardIcon(sp, opt, widget).pixmap(widget ? widget->window()->windowHandle() : 0,
QSize(size, size), mode,
sunken ? QIcon::On : QIcon::Off);

Expand Down

0 comments on commit 45a305f

Please sign in to comment.