]> git.lyx.org Git - features.git/commitdiff
Fix crash on OS-switch of dark/light mode (#12786)
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 10 Jun 2023 06:30:31 +0000 (08:30 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 10 Jun 2023 06:30:31 +0000 (08:30 +0200)
At least for Mac and Linux. Windows needs testing and possibly its
own fix.

src/frontends/qt/GuiView.cpp

index 581cd3194f27d60f8c325c642851e2cc4b6d4f8c..6f20db2f8d9178605ee31e2a5acb20e6a9fb0111 100644 (file)
@@ -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);
        }