commit 3af906e9f3466265718e10ad3d772f477990901d
Author: Juergen Spitzmueller <[email protected]>
Date:   Sat Jun 10 08:30:31 2023 +0200

    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 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 581cd31..6f20db2 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);
        }
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to