[Libreoffice-commits] core.git: toolkit/source vcl/source

Noel Grandin noel at peralex.com
Sat Oct 4 11:15:18 PDT 2014


 toolkit/source/awt/vclxtopwindow.cxx     |    7 ++++---
 vcl/source/window/menufloatingwindow.cxx |    4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit ad5e8b30ac66a00d0110fcdaf4d064181247585b
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Oct 4 20:11:40 2014 +0200

    fix for invalid dynamic_cast
    
    after my loplugin-cstylecast commits.
    this is a follow on to the bug reported in fdo#84608
    
    Change-Id: Icc4f4baf3690e939c07a71a949200270bf1f4614

diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx
index 21386ae..48b593e 100644
--- a/toolkit/source/awt/vclxtopwindow.cxx
+++ b/toolkit/source/awt/vclxtopwindow.cxx
@@ -147,15 +147,16 @@ void VCLXTopWindow_Base::setMenuBar( const ::com::sun::star::uno::Reference< ::c
 {
     SolarMutexGuard aGuard;
 
-    SystemWindow* pWindow = dynamic_cast<SystemWindow*>( GetWindowImpl() );
+    vcl::Window* pWindow = GetWindowImpl();
     if ( pWindow )
     {
-        pWindow->SetMenuBar( NULL );
+        SystemWindow* pSystemWindow = static_cast<SystemWindow*>( pWindow );
+        pSystemWindow->SetMenuBar( NULL );
         if ( rxMenu.is() )
         {
             VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu );
             if ( pMenu && !pMenu->IsPopupMenu() )
-                pWindow->SetMenuBar( static_cast<MenuBar*>( pMenu->GetMenu() ));
+                pSystemWindow->SetMenuBar( static_cast<MenuBar*>( pMenu->GetMenu() ));
         }
     }
     mxMenuBar = rxMenu;
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 7e93fe1..2e34bde 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -80,7 +80,7 @@ void MenuFloatingWindow::doShutdown()
             }
             if( i < nCount )
             {
-                MenuFloatingWindow* pPWin = dynamic_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
+                MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
                 if( pPWin )
                     pPWin->HighlightItem( i, false );
             }
@@ -682,7 +682,7 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime
             }
             if( i < nCount )
             {
-                MenuFloatingWindow* pPWin = dynamic_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
+                MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
                 if( pPWin && pPWin->nHighlightedItem != i )
                 {
                     pPWin->HighlightItem( i, true );


More information about the Libreoffice-commits mailing list