sw/source/uibase/app/apphdl.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 20a6c2df3ea899cce15775d954ffa50bb9dc81cd
Author:     Paris Oplopoios <paris.oplopo...@collabora.com>
AuthorDate: Mon Jun 12 00:49:27 2023 +0300
Commit:     Paris Oplopoios <parisop...@gmail.com>
CommitDate: Mon Jun 12 02:11:59 2023 +0200

    Fix unchecked dynamic cast
    
    Change-Id: If662e24bb864690ead959b2599a6448d84da0de9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152866
    Tested-by: Jenkins
    Reviewed-by: Paris Oplopoios <parisop...@gmail.com>

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index bd4cdbe28f0f..d7ab78d6e392 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -983,23 +983,27 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
         {
             if(pViewShell->GetWindow())
             {
-                auto pSwView = dynamic_cast<SwView *>( pViewShell );
-                if(pSwView !=  nullptr ||
-                   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
-                   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+                auto pSwView = dynamic_cast<SwView *>(pViewShell);
+                if (pSwView)
                 {
                     SwViewOption aNewOptions = 
*pSwView->GetWrtShell().GetViewOptions();
                     
aNewOptions.SetThemeName(svtools::ColorConfig::GetCurrentSchemeName());
                     SwViewColors aViewColors(*m_pColorConfig);
                     aNewOptions.SetColorConfig(aViewColors);
                     pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
-                    pViewShell->GetWindow()->Invalidate();
+
                     if (bOnlyInvalidateCurrentView)
                     {
                         
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
                             
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
                     }
                 }
+                if(pSwView !=  nullptr ||
+                   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
+                   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+                {
+                    pViewShell->GetWindow()->Invalidate();
+                }
             }
             if (bOnlyInvalidateCurrentView)
                 break;

Reply via email to