From fb5239d70934baba32bd097dbe2e327f01ceef9c Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 24 Jun 2017 11:17:05 +0200 Subject: [PATCH] Fixing memory errors The CGColorRef was retained once too often while the UIImage was overreleased. --- src/osx/carbon/utilscocoa.mm | 4 +--- src/osx/iphone/window.mm | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/osx/carbon/utilscocoa.mm b/src/osx/carbon/utilscocoa.mm index eec9ab241c..57996e27f9 100644 --- a/src/osx/carbon/utilscocoa.mm +++ b/src/osx/carbon/utilscocoa.mm @@ -167,9 +167,7 @@ WXWindow wxOSXGetKeyWindow() WX_UIImage wxOSXGetUIImageFromCGImage( CGImageRef image ) { - UIImage *newImage = [UIImage imageWithCGImage:image]; - [newImage autorelease]; - return( newImage ); + return [UIImage imageWithCGImage:image]; } wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, const wxSize& size) diff --git a/src/osx/iphone/window.mm b/src/osx/iphone/window.mm index 614080dc62..e6e208b318 100644 --- a/src/osx/iphone/window.mm +++ b/src/osx/iphone/window.mm @@ -476,7 +476,7 @@ void wxWidgetImpl::Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to void wxWidgetIPhoneImpl::SetBackgroundColour( const wxColour &col ) { - m_osxView.backgroundColor = [[UIColor alloc] initWithCGColor:col.GetCGColor()]; + m_osxView.backgroundColor = [UIColor colorWithCGColor:col.GetCGColor()]; } bool wxWidgetIPhoneImpl::SetBackgroundStyle(wxBackgroundStyle style)