From 3af906e9f3466265718e10ad3d772f477990901d Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 10 Jun 2023 08:30:31 +0200 Subject: [PATCH] Fix crash on OS-switch of dark/light mode (#12786) At least for Mac and Linux. Windows needs testing and possibly its own fix. --- src/frontends/qt/GuiView.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); } -- 2.39.5