]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/toolbar.cpp
Provide wxGetKeyState() studfor wxGTK under Windows.
[wxWidgets.git] / src / osx / carbon / toolbar.cpp
index 08917a2f28b643336acfc2e33494d9bd44e34da9..0f3944c373dfb2b7729a7ee06088f3811f0171bf 100644 (file)
@@ -932,6 +932,15 @@ wxToolBar::~wxToolBar()
     if ( !m_macToolbar )
         return;
 
+    // it might already have been uninstalled due to a previous call to Destroy, but in case
+    // wasn't, do so now, otherwise redraw events may occur for deleted objects
+    bool ownToolbarInstalled = false;
+    MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
+    if (ownToolbarInstalled)
+    {
+        MacUninstallNativeToolbar();
+    }
+
     CFIndex count = CFGetRetainCount( m_macToolbar ) ;
     // Leopard seems to have one refcount more, so we cannot check reliably at the moment
     if ( UMAGetSystemVersion() < 0x1050 )
@@ -1118,9 +1127,9 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
 
             SetAutomaticControlDragTrackingEnabledForWindow( tlw, true );
 
-            m_peer->Move(0,0,0,0 );
+            GetPeer()->Move(0,0,0,0 );
             SetSize( wxSIZE_AUTO_WIDTH, 0 );
-            m_peer->SetVisibility( false );
+            GetPeer()->SetVisibility( false );
             wxToolBarBase::Show( false );
         }
     }
@@ -1135,7 +1144,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
             ChangeWindowAttributes( tlw, 0, kWindowToolbarButtonAttribute );
             MacUninstallNativeToolbar();
 
-            m_peer->SetVisibility( true );
+            GetPeer()->SetVisibility( true );
         }
     }