From ca4664f209b98d52d98f180ddf99b4dfb017b5b1 Mon Sep 17 00:00:00 2001 From: xiaoyifang <105986+xiaoyifang@users.noreply.github.com> Date: Sat, 10 Jun 2023 22:26:24 +0800 Subject: [PATCH] fix: possible crash (#836) * fix: possible crash when show statusbar message * windows qt upgrade to qt6.5.1 * Update src/ui/mainstatusbar.cc --------- Co-authored-by: YiFang Xiao --- .github/workflows/macos-homebrew-xapian.yml | 2 +- .github/workflows/ubuntu-6.2-xapian.yml | 2 +- .github/workflows/windows-6.x-xapian.yml | 2 +- src/ui/mainstatusbar.cc | 8 +++++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/macos-homebrew-xapian.yml b/.github/workflows/macos-homebrew-xapian.yml index abf5be70..3996d7f6 100644 --- a/.github/workflows/macos-homebrew-xapian.yml +++ b/.github/workflows/macos-homebrew-xapian.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: os: [macos-11,macos-12] - qt_ver: [6.4.3] + qt_ver: [ 6.5.1 ] qt_arch: [clang_64] env: targetName: GoldenDict diff --git a/.github/workflows/ubuntu-6.2-xapian.yml b/.github/workflows/ubuntu-6.2-xapian.yml index ab983e1d..402674d3 100644 --- a/.github/workflows/ubuntu-6.2-xapian.yml +++ b/.github/workflows/ubuntu-6.2-xapian.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - qt_ver: [6.4.3] + qt_ver: [ 6.5.1 ] qt_arch: [gcc_64] env: version: 23.06.02 diff --git a/.github/workflows/windows-6.x-xapian.yml b/.github/workflows/windows-6.x-xapian.yml index 8e9ae3fb..0e2a4f51 100644 --- a/.github/workflows/windows-6.x-xapian.yml +++ b/.github/workflows/windows-6.x-xapian.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: os: [windows-2019] - qt_ver: [6.4.3] + qt_ver: [6.5.1] qt_arch: [win64_msvc2019_64] env: targetName: GoldenDict.exe diff --git a/src/ui/mainstatusbar.cc b/src/ui/mainstatusbar.cc index dc8374a9..ed9f1a0b 100644 --- a/src/ui/mainstatusbar.cc +++ b/src/ui/mainstatusbar.cc @@ -85,9 +85,11 @@ void MainStatusBar::showMessage(const QString & str, int timeout, const QPixmap { timer->start( timeout ); } - raise(); - show(); - move( QPoint( 0, parentWidget()->height() - height() ) ); + if ( parentWidget() && parentWidget()->isVisible() ) { + raise(); + show(); + move( QPoint( 0, parentWidget()->height() - height() ) ); + } } void MainStatusBar::mousePressEvent ( QMouseEvent * )