Skip to content

Commit

Permalink
fix: quick change fullscreen state crash
Browse files Browse the repository at this point in the history
Change-Id: If0ec5b64ecd8d96ba8bfa91e6681d2ffe44efa69
  • Loading branch information
Iceyer committed May 22, 2018
1 parent d33d8b0 commit 565bfd5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/widgets/dtitlebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ bool DTitlebarPrivate::isVisableOnFullscreen()
void DTitlebarPrivate::hideOnFullscreen()
{
D_Q(DTitlebar);
q->setProperty("_restore_height", q->height());
if (q->height() > 0) {
q->setProperty("_restore_height", q->height());
}
q->setFixedHeight(0);
}

Expand Down Expand Up @@ -265,8 +267,11 @@ void DTitlebarPrivate::updateFullscreen()
} else {
// must set to empty
quitFullButton->show();
mainWindow->menuWidget()->setParent(nullptr);
mainWindow->setMenuWidget(Q_NULLPTR);
if (mainWindow->menuWidget()) {
mainWindow->menuWidget()->setParent(nullptr);
mainWindow->setMenuWidget(Q_NULLPTR);
}

q->setParent(mainWindow);
q->show();
hideOnFullscreen();
Expand Down

0 comments on commit 565bfd5

Please sign in to comment.