]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/textctrl.mm
No significant change
[wxWidgets.git] / src / cocoa / textctrl.mm
index e0747d89831c832284216266195ae46ee6239bf6..c04e12a99e415cb21f33fb02994e47ca7052f751 100644 (file)
@@ -14,6 +14,8 @@
 
 #include "wx/cocoa/string.h"
 
+#include "wx/cocoa/autorelease.h"
+
 #import <Foundation/NSString.h>
 #import <AppKit/NSTextField.h>
 
@@ -30,6 +32,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID winid,
             const wxValidator& validator,
             const wxString& name)
 {
+    wxAutoNSAutoreleasePool pool;
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
     m_cocoaNSView = NULL;
@@ -44,8 +47,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID winid,
 
 wxTextCtrl::~wxTextCtrl()
 {
-    CocoaRemoveFromParent();
-    SetNSTextField(NULL);
+    DisassociateNSTextField(m_cocoaNSView);
 }
 
 void wxTextCtrl::Cocoa_didChangeText(void)
@@ -114,6 +116,7 @@ void wxTextCtrl::Replace(long, long, wxString const&)
 
 void wxTextCtrl::SetValue(wxString const& value)
 {
+    wxAutoNSAutoreleasePool pool;
     [GetNSTextField() setStringValue: wxNSStringWithWxString(value)];
 }
 
@@ -182,6 +185,7 @@ bool wxTextCtrl::CanUndo() const
 
 wxString wxTextCtrl::GetValue() const
 {
+    wxAutoNSAutoreleasePool pool;
     return wxString([[GetNSTextField() stringValue] lossyCString]);
 }