X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7d27dcf906d8a60e5673e189624091a973bcc319..771eb7a2a20bc3a9d8b213e41b0a7e22f300adc1:/src/cocoa/textctrl.mm diff --git a/src/cocoa/textctrl.mm b/src/cocoa/textctrl.mm index e0747d8983..c04e12a99e 100644 --- a/src/cocoa/textctrl.mm +++ b/src/cocoa/textctrl.mm @@ -14,6 +14,8 @@ #include "wx/cocoa/string.h" +#include "wx/cocoa/autorelease.h" + #import #import @@ -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]); }