diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index a8daf00882..87ce901da5 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2019,7 +2019,7 @@ void wxCocoaDataViewControl::InitOutlineView(long style) NSTableHeaderView* header = nil; if ( !(style & wxDV_NO_HEADER) ) { - header = [[wxDVCNSHeaderView alloc] initWithDVC:GetDataViewCtrl()]; + header = [[[wxDVCNSHeaderView alloc] initWithDVC:GetDataViewCtrl()] autorelease]; } [m_OutlineView setHeaderView:header]; diff --git a/src/osx/cocoa/statbox.mm b/src/osx/cocoa/statbox.mm index b49203df2b..7af80028cb 100644 --- a/src/osx/cocoa/statbox.mm +++ b/src/osx/cocoa/statbox.mm @@ -86,7 +86,7 @@ wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer, NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; wxNSBox* v = [[wxNSBox alloc] initWithFrame:r]; NSSize margin = { 0.0, 0.0 }; - [v setContentView:[[wxNSBoxContentView alloc] init]]; + [v setContentView:[[[wxNSBoxContentView alloc] init] autorelease]]; [v setContentViewMargins: margin]; [v sizeToFit]; wxStaticBoxCocoaImpl* c = new wxStaticBoxCocoaImpl( wxpeer, v ); diff --git a/src/osx/core/uilocale.mm b/src/osx/core/uilocale.mm index 299abb505e..4d0dd87c92 100644 --- a/src/osx/core/uilocale.mm +++ b/src/osx/core/uilocale.mm @@ -303,7 +303,9 @@ wxUILocaleImplCF::GetMonthName(wxDateTime::Month month, wxDateTime::NameForm for } NSString* monthName = [monthNames objectAtIndex:(month)]; - return wxCFStringRef::AsString(monthName); + wxCFStringRef cf(monthName); + [df release]; + return cf.AsString(); } wxString @@ -348,7 +350,9 @@ wxUILocaleImplCF::GetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFo } NSString* weekdayName = [weekdayNames objectAtIndex:(weekday)]; - return wxCFStringRef::AsString(weekdayName); + wxCFStringRef cf(weekdayName); + [df release]; + return cf.AsString(); } #endif // wxUSE_DATETIME diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index 838c7a276e..31df5c1e30 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -263,7 +263,7 @@ bool wxWebViewWebKit::Create(wxWindow *parent, { for (const auto& kv : m_handlers) { - [webViewConfig setURLSchemeHandler:[[WebViewCustomProtocol alloc] initWithHandler:kv.second.get()] + [webViewConfig setURLSchemeHandler:[[[WebViewCustomProtocol alloc] initWithHandler:kv.second.get()] autorelease] forURLScheme:wxCFStringRef(kv.first).AsNSString()]; } } @@ -334,7 +334,7 @@ bool wxWebViewWebKit::Create(wxWindow *parent, document.webkitFullscreenEnabled = true; \ "); [m_webView.configuration.userContentController addScriptMessageHandler: - [[WebViewScriptMessageHandler alloc] initWithWxWindow:this] name:@"__wxfullscreen"]; + [[[WebViewScriptMessageHandler alloc] initWithWxWindow:this]autorelease] name:@"__wxfullscreen"]; } m_UIDelegate = uiDelegate; @@ -620,7 +620,7 @@ void wxWebViewWebKit::RunScriptAsync(const wxString& javascript, void* clientDat bool wxWebViewWebKit::AddScriptMessageHandler(const wxString& name) { [m_webView.configuration.userContentController addScriptMessageHandler: - [[WebViewScriptMessageHandler alloc] initWithWxWindow:this] name:wxCFStringRef(name).AsNSString()]; + [[[WebViewScriptMessageHandler alloc] initWithWxWindow:this] autorelease] name:wxCFStringRef(name).AsNSString()]; // Make webkit message handler available under common name wxString js = wxString::Format("window.%s = window.webkit.messageHandlers.%s;", name, name); @@ -644,6 +644,7 @@ bool wxWebViewWebKit::AddUserScript(const wxString& javascript, WKUserScriptInjectionTimeAtDocumentStart : WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:NO]; [m_webView.configuration.userContentController addUserScript:userScript]; + [userScript release]; return true; } diff --git a/src/stc/PlatWXcocoa.mm b/src/stc/PlatWXcocoa.mm index 675fb99976..f3ca08b8ce 100644 --- a/src/stc/PlatWXcocoa.mm +++ b/src/stc/PlatWXcocoa.mm @@ -106,7 +106,7 @@ WX_NSWindow CreateFloatingWindow(wxWindow* wxWin) defer: NO]; [w setLevel:NSPopUpMenuWindowLevel]; [w setHasShadow:YES]; - [w setContentView:[[wxSTCPopupBaseView alloc] initWithwxWin:wxWin]]; + [w setContentView:[[[wxSTCPopupBaseView alloc] initWithwxWin:wxWin] autorelease]] ; return w; }