Skip to content

Commit 804939b

Browse files
committed
Make sure the pointer captured by lambda is not null before we work with it
1 parent 06cfac2 commit 804939b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

style/adwaitastyle.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,14 @@ void Style::polish(QWidget *widget)
409409

410410
#if QT_VERSION > 0x050000
411411
// HACK to avoid different text color in unfocused views
412-
if (QAbstractItemView *view = qobject_cast<QAbstractItemView *>(widget)) {
413-
QWindow *win = widget ? widget->window()->windowHandle() : nullptr;
412+
if (QPointer<QAbstractItemView> view = qobject_cast<QAbstractItemView *>(widget)) {
413+
QWindow *win = widget ? widget->window()->windowHandle() : nullptr;
414414
if (win) {
415415
connect(win, &QWindow::activeChanged, this, [=] () {
416+
if (view.isNull()) {
417+
return;
418+
}
419+
416420
QPalette pal = view->palette();
417421
if (win->isActive()) {
418422
pal.setColor(QPalette::Inactive, QPalette::Text, pal.color(QPalette::Active, QPalette::Text));

0 commit comments

Comments
 (0)