Changeset dc723a84d4d51c3db68193966c46be82dd0f7e15

Show
Ignore:
Timestamp:
07/04/06 20:38:30 (3 years ago)
Author:
Felix Paul Kühne <fkuehne@videolan.org>
git-committer:
Felix Paul Kühne <fkuehne@videolan.org> 1144435110 +0000
git-parent:

[1f8e57e56a742e99d643e9e75c2298972a7d2bf3]

git-author:
Felix Paul Kühne <fkuehne@videolan.org> 1144435110 +0000
Message:

* don't free a vlc-object. Thanks to Meuuh for pointing this out.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/macosx/bookmarks.m

    rb8f24b4 rdc723a8  
    22 * bookmarks.m: MacOS X Bookmarks window 
    33 ***************************************************************************** 
    4  * Copyright (C) 2005 the VideoLAN team 
     4 * Copyright (C) 2005, 2006 the VideoLAN team 
    55 * $Id$ 
    66 * 
     
    7878- (void)dealloc 
    7979{ 
    80     if(p_old_input
    81     { 
    82         free(p_old_input); 
     80    if( p_old_input
     81    { 
     82        vlc_object_release( p_old_input ); 
    8383    } 
    8484    [super dealloc]; 
     
    9696    [o_btn_extract setTitle: _NS("Extract")]; 
    9797    [o_btn_rm setTitle: _NS("Remove")]; 
    98     [[[o_tbl_dataTable tableColumnWithIdentifier:@"description"] headerCell] \ 
     98    [[[o_tbl_dataTable tableColumnWithIdentifier:@"description"] headerCell] 
    9999        setStringValue: _NS("Description")]; 
    100     [[[o_tbl_dataTable tableColumnWithIdentifier:@"size_offset"] headerCell] \ 
     100    [[[o_tbl_dataTable tableColumnWithIdentifier:@"size_offset"] headerCell] 
    101101        setStringValue: _NS("Position")]; 
    102     [[[o_tbl_dataTable tableColumnWithIdentifier:@"time_offset"] headerCell] \ 
     102    [[[o_tbl_dataTable tableColumnWithIdentifier:@"time_offset"] headerCell] 
    103103        setStringValue: _NS("Time")]; 
    104104         
     
    122122    /* add item to list */ 
    123123    intf_thread_t * p_intf = VLCIntf; 
    124     input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \ 
     124    input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, 
    125125        VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
    126126    if( !p_input ) 
     
    149149    /* clear table */ 
    150150    intf_thread_t * p_intf = VLCIntf; 
    151     input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, \ 
     151    input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, 
    152152        VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
    153153     
     
    168168     * really trust it */ 
    169169    intf_thread_t * p_intf = VLCIntf; 
    170     input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \ 
     170    input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, 
    171171        VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
    172172    seekpoint_t **pp_bookmarks; 
     
    183183        return; 
    184184    }  
    185     else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ 
     185    else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, 
    186186        &i_bookmarks ) != VLC_SUCCESS ) 
    187187    { 
     
    194194        return; 
    195195    } else { 
    196         [o_edit_fld_name setStringValue: [NSString stringWithUTF8String: \ 
     196        [o_edit_fld_name setStringValue: [NSString stringWithUTF8String: 
    197197            pp_bookmarks[row]->psz_name]]; 
    198         [o_edit_fld_time setStringValue: [[NSNumber numberWithInt: \ 
     198        [o_edit_fld_time setStringValue: [[NSNumber numberWithInt: 
    199199            (pp_bookmarks[row]->i_time_offset / 1000000)] stringValue]]; 
    200         [o_edit_fld_bytes setStringValue: [[NSNumber numberWithInt: \ 
     200        [o_edit_fld_bytes setStringValue: [[NSNumber numberWithInt: 
    201201            pp_bookmarks[row]->i_byte_offset] stringValue]]; 
    202202    } 
     
    226226    seekpoint_t **pp_bookmarks; 
    227227    int i_bookmarks, i; 
    228     input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, \ 
     228    input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, 
    229229        VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
    230230     
    231231    if( !p_input ) 
    232232    { 
    233         NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"), \ 
    234                 @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("No " \ 
    235                 "input found. A stream must be playing or paused for " \ 
     233        NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"), 
     234                @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("No " 
     235                "input found. A stream must be playing or paused for " 
    236236                "bookmarks to work.")); 
    237237        return; 
     
    239239    if( p_old_input != p_input ) 
    240240    { 
    241         NSBeginCriticalAlertSheet(_NS("Input has changed"), _NS("OK"), \ 
    242             @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("Input " \ 
    243             "has changed, unable to save bookmark. Suspending playback with " \ 
    244             "\"Pause\" while editing bookmarks to ensure to keep the same " \ 
     241        NSBeginCriticalAlertSheet(_NS("Input has changed"), _NS("OK"), 
     242            @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("Input " 
     243            "has changed, unable to save bookmark. Suspending playback with " 
     244            "\"Pause\" while editing bookmarks to ensure to keep the same " 
    245245            "input.")); 
    246246        vlc_object_release( p_input ); 
     
    248248    } 
    249249     
    250     if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ 
     250    if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, 
    251251        &i_bookmarks ) != VLC_SUCCESS ) 
    252252    { 
     
    266266    pp_bookmarks[i]->i_time_offset = ([[o_edit_fld_time stringValue] intValue]  * 1000000); 
    267267     
    268     if( input_Control( p_input, INPUT_CHANGE_BOOKMARK, pp_bookmarks[i], i ) \ 
     268    if( input_Control( p_input, INPUT_CHANGE_BOOKMARK, pp_bookmarks[i], i ) 
    269269        != VLC_SUCCESS ) 
    270270    { 
     
    290290    if( [o_tbl_dataTable numberOfSelectedRows] < 2 ) 
    291291    { 
    292         NSBeginAlertSheet(_NS("Invalid selection"), _NS("OK"), \ 
    293             @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("" \ 
    294             "Two bookmarks have to be selected.")); 
     292        NSBeginAlertSheet(_NS("Invalid selection"), _NS("OK"), 
     293            @"", @"", o_bookmarks_window, nil, nil, nil, nil,  
     294            _NS("Two bookmarks have to be selected.")); 
    295295        return; 
    296296    } 
     
    300300    if( !p_input ) 
    301301    { 
    302         NSBeginCriticalAlertSheet(_NS("No input found"), _NS("OK"), \ 
    303             @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("" \ 
    304             "The stream must be playing or paused for bookmarks to work.")); 
     302        NSBeginCriticalAlertSheet(_NS("No input found"), _NS("OK"), 
     303            @"", @"", o_bookmarks_window, nil, nil, nil, nil,  
     304            _NS("The stream must be playing or paused for bookmarks to work.")); 
    305305        return; 
    306306    } 
     
    332332    msg_Dbg(p_intf, "got the bookmark-indexes"); 
    333333     
    334     if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ 
     334    if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, 
    335335        &i_bookmarks ) != VLC_SUCCESS ) 
    336336    { 
     
    341341    msg_Dbg(p_intf, "calling wizard"); 
    342342 
    343     [[[VLCMain sharedInstance] getWizard] initWithExtractValuesFrom: \ 
    344             [[NSNumber numberWithInt: \ 
    345             (pp_bookmarks[i_first]->i_time_offset/1000000)] stringValue] \ 
    346             to: [[NSNumber numberWithInt: \ 
    347             (pp_bookmarks[i_second]->i_time_offset/1000000)] stringValue] \ 
    348             ofItem: [NSString stringWithUTF8String: \ 
     343    [[[VLCMain sharedInstance] getWizard] initWithExtractValuesFrom: 
     344            [[NSNumber numberWithInt: 
     345            (pp_bookmarks[i_first]->i_time_offset/1000000)] stringValue] 
     346            to: [[NSNumber numberWithInt: 
     347            (pp_bookmarks[i_second]->i_time_offset/1000000)] stringValue] 
     348            ofItem: [NSString stringWithUTF8String: 
    349349            p_input->input.p_item->psz_uri]]; 
    350350    vlc_object_release( p_input ); 
     
    356356    intf_thread_t * p_intf = VLCIntf; 
    357357    input_thread_t *p_input = 
    358     (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
     358    (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,  
     359        FIND_ANYWHERE ); 
    359360     
    360361    if( !p_input )  
     
    373374    intf_thread_t * p_intf = VLCIntf; 
    374375    input_thread_t *p_input = 
    375     (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
     376    (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,  
     377        FIND_ANYWHERE ); 
    376378     
    377379    if( !p_input ) return; 
     
    405407    /* return the number of bookmarks */ 
    406408    intf_thread_t * p_intf = VLCIntf; 
    407     input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \ 
     409    input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, 
    408410        VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
    409411    seekpoint_t **pp_bookmarks; 
     
    414416        return 0; 
    415417    } 
    416     else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ 
     418    else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, 
    417419                       &i_bookmarks ) != VLC_SUCCESS ) 
    418420    { 
     
    426428} 
    427429 
    428 - (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn: \ 
     430- (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn: 
    429431    (NSTableColumn *)theTableColumn row: (int)row 
    430432{ 
    431433    /* return the corresponding data as NSString */ 
    432434    intf_thread_t * p_intf = VLCIntf; 
    433     input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \ 
     435    input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, 
    434436        VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
    435437    seekpoint_t **pp_bookmarks; 
     
    444446        return @""; 
    445447    }  
    446     else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ 
     448    else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, 
    447449                       &i_bookmarks ) != VLC_SUCCESS ) 
    448450    { 
     
    468470            i_toBeReturned = pp_bookmarks[row]->i_time_offset; 
    469471            vlc_object_release( p_input ); 
    470             return [[NSNumber numberWithInt: (i_toBeReturned / 1000000)] \ 
     472            return [[NSNumber numberWithInt: (i_toBeReturned / 1000000)] 
    471473                stringValue]; 
    472474        } 
     
    475477            /* may not happen, but just in case */ 
    476478            vlc_object_release( p_input ); 
    477             msg_Err(p_intf, "unknown table column identifier (%s) while" \ 
    478                 "updating the bookmark table", [[theTableColumn identifier] \ 
     479            msg_Err(p_intf, "unknown table column identifier (%s) while " 
     480                "updating the bookmark table", [[theTableColumn identifier] 
    479481 
    480482                UTF8String] );