[vlc-commits] macosx: fixed a few memory leaks
Felix Paul Kühne
git at videolan.org
Fri Jul 29 23:10:09 CEST 2011
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Jul 29 23:10:07 2011 +0200| [cc82de22fe64d1d784cdcdb54e766faa86ba5d9e] | committer: Felix Paul Kühne
macosx: fixed a few memory leaks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cc82de22fe64d1d784cdcdb54e766faa86ba5d9e
---
modules/gui/macosx/MainMenu.m | 2 ++
modules/gui/macosx/MainWindow.m | 27 ++++++++++++++++++++-------
modules/gui/macosx/playlistinfo.m | 2 ++
3 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index c1d7655..be5abdd 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -508,6 +508,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (void)setRateControlsEnabled:(BOOL)b_enabled
{
+ NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
[o_mi_rate_sld setEnabled: b_enabled];
[o_mi_rate_sld setIntValue: [[VLCCoreInteraction sharedInstance] playbackRate]];
int i = [[VLCCoreInteraction sharedInstance] playbackRate];
@@ -523,6 +524,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_rate_lbl setHidden: YES];
[o_mi_rate_lbl_gray setHidden: NO];
}
+ [o_pool release];
}
#pragma mark -
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index dca06f7..ea0f4ba 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -459,6 +459,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
p_input = pl_CurrentInput( VLCIntf );
if( p_input )
{
+ NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
vlc_value_t time;
NSString * o_time;
vlc_value_t pos;
@@ -482,6 +483,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_time_fld setStringValue: o_time];
[o_time_fld setNeedsDisplay:YES];
// [[[[VLCMain sharedInstance] controls] fspanel] setStreamPos: f_updated andTime: o_time];
+ [o_pool release];
}
else
{
@@ -511,8 +513,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)updateName
{
+ NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
input_thread_t * p_input;
-
p_input = pl_CurrentInput( VLCIntf );
if( p_input )
{
@@ -564,6 +566,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self setTitle: _NS("VLC media player")];
[self setRepresentedFilename: @""];
}
+ [o_pool release];
}
- (void)updateWindow
@@ -639,6 +642,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)drawFancyGradientEffectForTimeSlider
{
+ NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
float f_value = ([o_time_sld_middle_view frame].size.width -5) * ([o_time_sld intValue] / [o_time_sld maxValue]);
if (f_value > 5.0)
{
@@ -654,6 +658,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{
[o_time_sld_fancygradient_view setHidden: YES];
}
+ [o_pool release];
}
#pragma mark -
@@ -681,19 +686,27 @@ static VLCMainWindow *_o_sharedInstance = nil;
@end
@implementation VLCProgressBarGradientEffect
+- (void)dealloc
+{
+ [o_time_sld_gradient_left_img release];
+ [o_time_sld_gradient_middle_img release];
+ [o_time_sld_gradient_right_img release];
+ [super dealloc];
+}
+
- (void)loadImagesInDarkStyle: (BOOL)b_value
{
if (b_value)
{
- o_time_sld_gradient_left_img = [NSImage imageNamed:@"progressbar-fill-left_dark"];
- o_time_sld_gradient_middle_img = [NSImage imageNamed:@"progressbar-fill-middle_dark"];
- o_time_sld_gradient_right_img = [NSImage imageNamed:@"progressbar-fill-right_dark"];
+ o_time_sld_gradient_left_img = [[NSImage imageNamed:@"progressbar-fill-left_dark"] retain];
+ o_time_sld_gradient_middle_img = [[NSImage imageNamed:@"progressbar-fill-middle_dark"] retain];
+ o_time_sld_gradient_right_img = [[NSImage imageNamed:@"progressbar-fill-right_dark"] retain];
}
else
{
- o_time_sld_gradient_left_img = [NSImage imageNamed:@"progression-fill-left"];
- o_time_sld_gradient_middle_img = [NSImage imageNamed:@"progression-fill-middle"];
- o_time_sld_gradient_right_img = [NSImage imageNamed:@"progression-fill-right"];
+ o_time_sld_gradient_left_img = [[NSImage imageNamed:@"progression-fill-left"] retain];
+ o_time_sld_gradient_middle_img = [[NSImage imageNamed:@"progression-fill-middle"] retain];
+ o_time_sld_gradient_right_img = [[NSImage imageNamed:@"progression-fill-right"] retain];
}
}
diff --git a/modules/gui/macosx/playlistinfo.m b/modules/gui/macosx/playlistinfo.m
index b6a4e5b..84defb9 100644
--- a/modules/gui/macosx/playlistinfo.m
+++ b/modules/gui/macosx/playlistinfo.m
@@ -174,6 +174,7 @@ static VLCInfo *_o_sharedInstance = nil;
- (void)updatePanelWithItem:(input_item_t *)_p_item;
{
+ NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
if( _p_item != p_item )
{
if( p_item ) vlc_gc_decref( p_item );
@@ -260,6 +261,7 @@ static VLCInfo *_o_sharedInstance = nil;
/* update the stats once to display p_item change faster */
[self updateStatistics];
+ [o_pool release];
}
- (void)setMeta: (char *)psz_meta forLabel: (id)theItem
More information about the vlc-commits
mailing list