From: Juergen Spitzmueller Date: Sat, 10 Jun 2023 06:30:31 +0000 (+0200) Subject: Fix crash on OS-switch of dark/light mode (#12786) X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3af906e9f3466265718e10ad3d772f477990901d;p=features.git Fix crash on OS-switch of dark/light mode (#12786) At least for Mac and Linux. Windows needs testing and possibly its own fix. --- diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index 581cd3194f..6f20db2f8d 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -1746,7 +1746,9 @@ bool GuiView::event(QEvent * e) } case QEvent::ApplicationPaletteChange: { - // runtime switch from/to dark mode + // runtime switch from/to dark mode (Mac OS) + // We need to update metrics here to avoid a crash (#12786) + theBufferList().changed(true); refillToolbars(); return QMainWindow::event(e); } @@ -1772,6 +1774,13 @@ bool GuiView::event(QEvent * e) return QMainWindow::event(e); } + case QEvent::StyleChange: { + // This might be a change from dark to light mode (Linux) + // We need to update metrics here to avoid a crash (#12786) + theBufferList().changed(true); + return QMainWindow::event(e); + } + default: return QMainWindow::event(e); }