]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/window.mm
wxCocoa: Allow calendar control, spin button, spin control
[wxWidgets.git] / src / cocoa / window.mm
index 5666a121ac7248632928f2b9b91f387f39823552..683ef6fc23ab40a4ec9e9b79d97bb8e76fd6edd9 100644 (file)
@@ -12,6 +12,8 @@
 #include "wx/window.h"
 #include "wx/log.h"
 
+#include "wx/cocoa/autorelease.h"
+
 #import <Appkit/NSView.h>
 #import <AppKit/NSEvent.h>
 
@@ -64,6 +66,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID winid,
 // Destructor
 wxWindow::~wxWindow()
 {
+    wxAutoNSAutoreleasePool pool;
     DestroyChildren();
 
     if(m_parent)
@@ -108,13 +111,11 @@ void wxWindowCocoa::SetNSView(WX_NSView cocoaNSView)
 {
     bool need_debug = cocoaNSView || m_cocoaNSView;
     if(need_debug) wxLogDebug("wxWindowCocoa=%p::SetNSView [m_cocoaNSView=%p retainCount]=%d",this,m_cocoaNSView,[m_cocoaNSView retainCount]);
-    if(m_cocoaNSView)
-        DisassociateNSView(m_cocoaNSView);
+    DisassociateNSView(m_cocoaNSView);
     [cocoaNSView retain];
     [m_cocoaNSView release];
     m_cocoaNSView = cocoaNSView;
-    if(m_cocoaNSView)
-        AssociateNSView(m_cocoaNSView);
+    AssociateNSView(m_cocoaNSView);
     if(need_debug) wxLogDebug("wxWindowCocoa=%p::SetNSView [cocoaNSView=%p retainCount]=%d",this,cocoaNSView,[cocoaNSView retainCount]);
 }
 
@@ -246,6 +247,7 @@ bool wxWindow::Close(bool force)
 
 bool wxWindow::Show(bool show)
 {
+    wxAutoNSAutoreleasePool pool;
     // If the window is marked as visible, then it shouldn't have a dummy view
     // If the window is marked hidden, then it should have a dummy view
     wxASSERT_MSG( (m_isShown && !m_dummyNSView) || (!m_isShown && m_dummyNSView),"wxWindow: m_isShown does not agree with m_dummyNSView");
@@ -487,6 +489,7 @@ void wxWindow::Clear()
 // Raise the window to the top of the Z order
 void wxWindow::Raise()
 {
+    wxAutoNSAutoreleasePool pool;
     NSView *nsview = m_dummyNSView?m_dummyNSView:m_cocoaNSView;
     NSView *superview = [nsview superview];
     [nsview retain];