Commit 275126b2 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman Committed by Jean-Baptiste Kempf

memleaks: Several Mac OS X interface related memleaks.

(cherry picked from commit bc3883a52ee35d2d118f8a7c43093faa253cc0b4)
parent 5f567ca5
...@@ -840,7 +840,7 @@ ...@@ -840,7 +840,7 @@
text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string ]; text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string ];
o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""]; o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""];
o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: strdup(psz_variable) ofObject: p_object o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
andValue: another_val ofType: i_type]; andValue: another_val ofType: i_type];
[o_lmi setRepresentedObject: [o_data autorelease]]; [o_lmi setRepresentedObject: [o_data autorelease]];
[o_lmi setTarget: self]; [o_lmi setTarget: self];
...@@ -858,7 +858,7 @@ ...@@ -858,7 +858,7 @@
val_list.p_list->p_values[i].i_int]; val_list.p_list->p_values[i].i_int];
o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""]; o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""];
o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: strdup(psz_variable) ofObject: p_object o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
andValue: val_list.p_list->p_values[i] ofType: i_type]; andValue: val_list.p_list->p_values[i] ofType: i_type];
[o_lmi setRepresentedObject: [o_data autorelease]]; [o_lmi setRepresentedObject: [o_data autorelease]];
[o_lmi setTarget: self]; [o_lmi setTarget: self];
......
...@@ -601,6 +601,7 @@ ...@@ -601,6 +601,7 @@
[o_mi_revealInFinder setEnabled: YES]; [o_mi_revealInFinder setEnabled: YES];
[o_mm_mi_revealInFinder setEnabled: YES]; [o_mm_mi_revealInFinder setEnabled: YES];
} }
free( psz_uri );
} }
if( [[VLCMain sharedInstance] isPlaylistCollapsed] == NO ) if( [[VLCMain sharedInstance] isPlaylistCollapsed] == NO )
......
...@@ -389,6 +389,13 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -389,6 +389,13 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[object setToolTip: _NS(p_item->psz_longtext)]; [object setToolTip: _NS(p_item->psz_longtext)];
} }
- (void)setupField:(NSTextField *)o_object forOption:(const char *)psz_option
{
char *psz_tmp = config_GetPsz( p_intf, psz_option );
[o_object setStringValue: [NSString stringWithUTF8String: psz_tmp ?: ""]];
free( psz_tmp );
}
- (void)resetControls - (void)resetControls
{ {
module_config_t *p_item; module_config_t *p_item;
...@@ -417,8 +424,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -417,8 +424,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_audio_spdif_ckb setState: config_GetInt( p_intf, "spdif" )]; [o_audio_spdif_ckb setState: config_GetInt( p_intf, "spdif" )];
[self setupButton: o_audio_dolby_pop forIntList: "force-dolby-surround"]; [self setupButton: o_audio_dolby_pop forIntList: "force-dolby-surround"];
[self setupField: o_audio_lang_fld forOption: "audio-language"];
[o_audio_lang_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "audio-language" ) ?: ""]];
[o_audio_headphone_ckb setState: config_GetInt( p_intf, "headphone-dolby" )]; [o_audio_headphone_ckb setState: config_GetInt( p_intf, "headphone-dolby" )];
...@@ -428,6 +434,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -428,6 +434,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_audio_norm_ckb setState: (NSInteger)strstr( psz_tmp, "volnorm" )]; [o_audio_norm_ckb setState: (NSInteger)strstr( psz_tmp, "volnorm" )];
[o_audio_norm_fld setEnabled: [o_audio_norm_ckb state]]; [o_audio_norm_fld setEnabled: [o_audio_norm_ckb state]];
[o_audio_norm_stepper setEnabled: [o_audio_norm_ckb state]]; [o_audio_norm_stepper setEnabled: [o_audio_norm_ckb state]];
free( psz_tmp );
} }
[o_audio_norm_fld setFloatValue: config_GetFloat( p_intf, "norm-max-level" )]; [o_audio_norm_fld setFloatValue: config_GetFloat( p_intf, "norm-max-level" )];
...@@ -436,8 +443,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -436,8 +443,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
/* Last.FM is optional */ /* Last.FM is optional */
if( module_exists( "audioscrobbler" ) ) if( module_exists( "audioscrobbler" ) )
{ {
[o_audio_lastuser_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "lastfm-username" ) ?: ""]]; [self setupField: o_audio_lastuser_fld forOption:"lastfm-username"];
[o_audio_lastpwd_sfld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "lastfm-password" ) ?: ""]]; [self setupField: o_audio_lastpwd_sfld forOption:"lastfm-password"];
if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) ) if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) )
{ {
...@@ -483,8 +490,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -483,8 +490,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_video_device_pop selectItemAtIndex: 0]; [o_video_device_pop selectItemAtIndex: 0];
[o_video_device_pop selectItemWithTag: config_GetInt( p_intf, "macosx-vdev" )]; [o_video_device_pop selectItemWithTag: config_GetInt( p_intf, "macosx-vdev" )];
[o_video_snap_folder_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "snapshot-path" ) ?: ""]]; [self setupField:o_video_snap_folder_fld forOption:"snapshot-path"];
[o_video_snap_prefix_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "snapshot-prefix" ) ?: ""]]; [self setupField:o_video_snap_prefix_fld forOption:"snapshot-prefix"];
[o_video_snap_seqnum_ckb setState: config_GetInt( p_intf, "snapshot-sequential" )]; [o_video_snap_seqnum_ckb setState: config_GetInt( p_intf, "snapshot-sequential" )];
[self setupButton: o_video_snap_format_pop forStringList: "snapshot-format"]; [self setupButton: o_video_snap_format_pop forStringList: "snapshot-format"];
...@@ -492,10 +499,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -492,10 +499,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
* input & codecs settings * * input & codecs settings *
***************************/ ***************************/
[o_input_serverport_fld setIntValue: config_GetInt( p_intf, "server-port" )]; [o_input_serverport_fld setIntValue: config_GetInt( p_intf, "server-port" )];
if( config_GetPsz( p_intf, "http-proxy" ) != NULL ) [self setupField:o_input_httpproxy_fld forOption:"http-proxy"];
[o_input_httpproxy_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "http-proxy" ) ?: ""]]; [self setupField:o_input_httpproxypwd_sfld forOption:"http-proxy-pwd"];
if( config_GetPsz( p_intf, "http-proxy" ) != NULL )
[o_input_httpproxypwd_sfld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "http-proxy-pwd" ) ?: ""]];
[o_input_postproc_fld setIntValue: config_GetInt( p_intf, "postproc-q" )]; [o_input_postproc_fld setIntValue: config_GetInt( p_intf, "postproc-q" )];
[self setupButton: o_input_avi_pop forIntList: "avi-index"]; [self setupButton: o_input_avi_pop forIntList: "avi-index"];
...@@ -559,10 +564,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -559,10 +564,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_osd_osd_ckb setState: config_GetInt( p_intf, "osd" )]; [o_osd_osd_ckb setState: config_GetInt( p_intf, "osd" )];
[self setupButton: o_osd_encoding_pop forStringList: "subsdec-encoding"]; [self setupButton: o_osd_encoding_pop forStringList: "subsdec-encoding"];
[self setupField: o_osd_lang_fld forOption: "sub-language" ];
[o_osd_lang_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "sub-language" ) ?: ""]]; [self setupField: o_osd_font_fld forOption: "quartztext-font"];
if( config_GetPsz( p_intf, "quartztext-font" ) != NULL )
[o_osd_font_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "quartztext-font" ) ?: ""]];
[self setupButton: o_osd_font_color_pop forIntList: "quartztext-color"]; [self setupButton: o_osd_font_color_pop forIntList: "quartztext-color"];
[self setupButton: o_osd_font_size_pop forIntList: "quartztext-rel-fontsize"]; [self setupButton: o_osd_font_size_pop forIntList: "quartztext-rel-fontsize"];
...@@ -755,6 +758,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -755,6 +758,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
/* work-around a GCC 4.0.1 bug */ /* work-around a GCC 4.0.1 bug */
psz_tmp = (char *)[[NSString stringWithFormat: @"%s:volnorm", psz_tmp] UTF8String]; psz_tmp = (char *)[[NSString stringWithFormat: @"%s:volnorm", psz_tmp] UTF8String];
config_PutPsz( p_intf, "audio-filter", psz_tmp ); config_PutPsz( p_intf, "audio-filter", psz_tmp );
free( psz_tmp );
} }
} }
else else
...@@ -762,10 +766,11 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -762,10 +766,11 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
psz_tmp = config_GetPsz( p_intf, "audio-filter" ); psz_tmp = config_GetPsz( p_intf, "audio-filter" );
if( psz_tmp ) if( psz_tmp )
{ {
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@":volnorm"]] UTF8String]; char *psz_tmp2 = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@":volnorm"]] UTF8String];
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"volnorm:"]] UTF8String]; psz_tmp2 = (char *)[[[NSString stringWithUTF8String: psz_tmp2] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"volnorm:"]] UTF8String];
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"volnorm"]] UTF8String]; psz_tmp2 = (char *)[[[NSString stringWithUTF8String: psz_tmp2] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"volnorm"]] UTF8String];
config_PutPsz( p_intf, "audio-filter", psz_tmp ); config_PutPsz( p_intf, "audio-filter", psz_tmp );
free( psz_tmp );
} }
} }
config_PutFloat( p_intf, "norm-max-level", [o_audio_norm_fld floatValue] ); config_PutFloat( p_intf, "norm-max-level", [o_audio_norm_fld floatValue] );
......
...@@ -749,7 +749,9 @@ static offscreen_bitmap_t *Compose( int i_text_align, UniChar *psz_utf16_str, ui ...@@ -749,7 +749,9 @@ static offscreen_bitmap_t *Compose( int i_text_align, UniChar *psz_utf16_str, ui
CGContextSetTextDrawingMode( p_context, kCGTextFillStroke ); CGContextSetTextDrawingMode( p_context, kCGTextFillStroke );
CGContextSetShadow( p_context, CGSizeMake( 0, 0 ), 5 ); CGContextSetShadow( p_context, CGSizeMake( 0, 0 ), 5 );
float black_components[4] = {0, 0, 0, 1}; float black_components[4] = {0, 0, 0, 1};
CGContextSetShadowWithColor (p_context, CGSizeMake( 0, 0 ), 5, CGColorCreate( CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB ), black_components )); CGColorRef outlinecolor = CGColorCreate( CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB ), black_components );
CGContextSetShadowWithColor (p_context, CGSizeMake( 0, 0 ), 5, outlinecolor);
CGColorRelease( outlinecolor );
do do
{ {
// ATSUBreakLine will automatically pick up any manual '\n's also // ATSUBreakLine will automatically pick up any manual '\n's also
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment