Changeset 5637


Ignore:
Timestamp:
Apr 17, 2008, 8:35:18 PM (14 years ago)
Author:
charles
Message:

(gtk) fix potential invalid memory read on shutdown

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r5615 r5637  
    551551    struct cbdata * cbdata = gdata;
    552552
    553     tr_close( tr_core_handle( cbdata->core ) );
     553    tr_core_close( cbdata->core );
    554554
    555555    /* shutdown the gui */
  • trunk/gtk/tr-core.c

    r5588 r5637  
    552552}
    553553
     554void
     555tr_core_close( TrCore * core )
     556{
     557    tr_handle * handle = tr_core_handle( core );
     558    if( handle )
     559    {
     560        core->priv->handle = NULL;
     561        tr_close( handle );
     562    }
     563}
     564
    554565GtkTreeModel *
    555566tr_core_model( TrCore * core )
     
    596607                         &setme->clientDownloadSpeed,
    597608                         &setme->clientUploadSpeed );
     609
    598610        gtk_tree_model_foreach( core->priv->model,
    599611                                statsForeach,
  • trunk/gtk/tr-core.h

    r5476 r5637  
    9191
    9292TrCore * tr_core_new( void );
     93
     94void tr_core_close( TrCore* );
    9395
    9496/* Return the model used without incrementing the reference count */
  • trunk/libtransmission/session.c

    r5636 r5637  
    363363tr_torrentRates( tr_handle * h, float * toClient, float * toPeer )
    364364{
    365     tr_globalLock( h );
    366 
    367     if( toClient )
    368         *toClient = tr_rcRate( h->download );
    369     if( toPeer )
    370         *toPeer = tr_rcRate( h->upload );
    371 
    372     tr_globalUnlock( h );
     365    if( h )
     366    {
     367        tr_globalLock( h );
     368
     369        if( toClient )
     370            *toClient = tr_rcRate( h->download );
     371        if( toPeer )
     372            *toPeer = tr_rcRate( h->upload );
     373
     374        tr_globalUnlock( h );
     375    }
    373376}
    374377
Note: See TracChangeset for help on using the changeset viewer.