#include <vlc_gcrypt.h>
#include "update.h"
+#include "../libvlc.h"
/*****************************************************************************
* Misc defines
{
assert( p_update );
- vlc_mutex_lock( &p_update->lock );
-
if( p_update->p_check )
{
assert( !p_update->p_download );
vlc_thread_join( p_update->p_download );
}
- vlc_mutex_unlock( &p_update->lock );
vlc_mutex_destroy( &p_update->lock );
free( p_update->release.psz_url );
{
assert( p_update );
- update_check_thread_t *p_uct = vlc_object_create( p_update->p_libvlc,
- sizeof( update_check_thread_t ) );
+ update_check_thread_t *p_uct =
+ vlc_custom_create( p_update->p_libvlc, sizeof( *p_uct ),
+ VLC_OBJECT_GENERIC, "update check" );
if( !p_uct ) return;
p_uct->p_update = p_update;
{
assert( p_update );
- update_download_thread_t *p_udt = vlc_object_create( p_update->p_libvlc,
- sizeof( update_download_thread_t ) );
+ update_download_thread_t *p_udt =
+ vlc_custom_create( p_update->p_libvlc, sizeof( *p_udt ),
+ VLC_OBJECT_GENERIC, "update download" );
if( !p_udt )
return;
free( psz_status );
}
- while( ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
- !intf_ProgressIsCancelled( p_udt, i_progress ) )
+ vlc_object_lock( p_udt );
+ while( vlc_object_alive( p_udt ) &&
+ ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
+ !intf_ProgressIsCancelled( p_udt, i_progress ) )
{
+ vlc_object_unlock( p_udt );
if( fwrite( p_buffer, i_read, 1, p_file ) < 1 )
{
msg_Err( p_udt, "Failed to write into %s", psz_destfile );
free( psz_status );
}
free( psz_downloaded );
+ vlc_object_lock( p_udt );
}
/* Finish the progress bar or delete the file if the user had canceled */
fclose( p_file );
p_file = NULL;
- if( !intf_ProgressIsCancelled( p_udt, i_progress ) )
+ if( vlc_object_alive( p_udt ) &&
+ !intf_ProgressIsCancelled( p_udt, i_progress ) )
{
+ vlc_object_unlock( p_udt );
if( asprintf( &psz_status, "%s\nDone %s (100.0%%)",
p_update->release.psz_url, psz_size ) != -1 )
{
}
else
{
+ vlc_object_unlock( p_udt );
utf8_unlink( psz_destfile );
goto end;
}
{
utf8_unlink( psz_destfile );
- intf_UserFatal( p_udt, true, _("File can not be verified"),
+ intf_UserFatal( p_udt, true, _("File could not be verified"),
_("It was not possible to download a cryptographic signature for "
- "downloaded file \"%s\", and so VLC deleted it."),
+ "the downloaded file \"%s\". Thus, it was deleted."),
psz_destfile );
msg_Err( p_udt, "Couldn't download signature of downloaded file" );
goto end;
utf8_unlink( psz_destfile );
msg_Err( p_udt, "Invalid signature issuer" );
intf_UserFatal( p_udt, true, _("Invalid signature"),
- _("The cryptographic signature for downloaded file \"%s\" was "
- "invalid and couldn't be used to securely verify it, and so "
- "VLC deleted it."),
+ _("The cryptographic signature for the downloaded file \"%s\" was "
+ "invalid and could not be used to securely verify it. Thus, the "
+ "file was deleted."),
psz_destfile );
goto end;
}
utf8_unlink( psz_destfile );
msg_Err( p_udt, "Invalid signature type" );
intf_UserFatal( p_udt, true, _("Invalid signature"),
- _("The cryptographic signature for downloaded file \"%s\" was "
- "invalid and couldn't be used to securely verify it, and so "
- "VLC deleted it."),
+ _("The cryptographic signature for the downloaded file \"%s\" was "
+ "invalid and could not be used to securely verify it. Thus, the "
+ "file was deleted."),
psz_destfile );
goto end;
}
msg_Err( p_udt, "Unable to hash %s", psz_destfile );
utf8_unlink( psz_destfile );
intf_UserFatal( p_udt, true, _("File not verifiable"),
- _("It was not possible to securely verify downloaded file \"%s\", "
- "and so VLC deleted it."),
+ _("It was not possible to securely verify the downloaded file"
+ " \"%s\". Thus, it was VLC deleted."),
psz_destfile );
goto end;
{
utf8_unlink( psz_destfile );
intf_UserFatal( p_udt, true, _("File corrupted"),
- _("Downloaded file \"%s\" was corrupted, and so VLC deleted it."),
+ _("Downloaded file \"%s\" was corrupted. Thus, it was deleted."),
psz_destfile );
msg_Err( p_udt, "Bad SHA1 hash for %s", psz_destfile );
free( p_hash );
{
utf8_unlink( psz_destfile );
intf_UserFatal( p_udt, true, _("File corrupted"),
- _("Downloaded file \"%s\" was corrupted, and so VLC deleted it."),
+ _("Downloaded file \"%s\" was corrupted. Thus, it was deleted."),
psz_destfile );
msg_Err( p_udt, "BAD SIGNATURE for %s", psz_destfile );
free( p_hash );