{
struct cbdata * cbdata = gdata;
- tr_close( tr_core_handle( cbdata->core ) );
+ tr_core_close( cbdata->core );
/* shutdown the gui */
if( cbdata->prefs )
return core;
}
+void
+tr_core_close( TrCore * core )
+{
+ tr_handle * handle = tr_core_handle( core );
+ if( handle )
+ {
+ core->priv->handle = NULL;
+ tr_close( handle );
+ }
+}
+
GtkTreeModel *
tr_core_model( TrCore * core )
{
tr_torrentRates( core->priv->handle,
&setme->clientDownloadSpeed,
&setme->clientUploadSpeed );
+
gtk_tree_model_foreach( core->priv->model,
statsForeach,
setme );
TrCore * tr_core_new( void );
+void tr_core_close( TrCore* );
+
/* Return the model used without incrementing the reference count */
GtkTreeModel * tr_core_model( TrCore * self );
void
tr_torrentRates( tr_handle * h, float * toClient, float * toPeer )
{
- tr_globalLock( h );
+ if( h )
+ {
+ tr_globalLock( h );
- if( toClient )
- *toClient = tr_rcRate( h->download );
- if( toPeer )
- *toPeer = tr_rcRate( h->upload );
+ if( toClient )
+ *toClient = tr_rcRate( h->download );
+ if( toPeer )
+ *toPeer = tr_rcRate( h->upload );
- tr_globalUnlock( h );
+ tr_globalUnlock( h );
+ }
}
int