mirror of
https://github.com/videolan/vlc.git
synced 2024-11-27 20:03:31 +08:00
demux: adaptative: fix uninitialized thread_t (fix #1346983)
Sets dumb initializer, and adds member to avoid joining invalid thread reference.
This commit is contained in:
parent
efe5041cc3
commit
d64372c7c3
@ -29,15 +29,19 @@ Downloader::Downloader()
|
||||
vlc_mutex_init(&lock);
|
||||
vlc_cond_init(&waitcond);
|
||||
killed = false;
|
||||
thread_handle = { 0 };
|
||||
thread_handle_valid = false;
|
||||
}
|
||||
|
||||
bool Downloader::start()
|
||||
{
|
||||
if(vlc_clone(&thread_handle, downloaderThread,
|
||||
if(!thread_handle_valid &&
|
||||
vlc_clone(&thread_handle, downloaderThread,
|
||||
reinterpret_cast<void *>(this), VLC_THREAD_PRIORITY_INPUT))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
thread_handle_valid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -45,7 +49,8 @@ Downloader::~Downloader()
|
||||
{
|
||||
killed = true;
|
||||
vlc_cond_signal(&waitcond);
|
||||
vlc_join(thread_handle, NULL);
|
||||
if(thread_handle_valid)
|
||||
vlc_join(thread_handle, NULL);
|
||||
vlc_mutex_destroy(&lock);
|
||||
vlc_cond_destroy(&waitcond);
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ namespace adaptative
|
||||
vlc_mutex_t lock;
|
||||
vlc_cond_t waitcond;
|
||||
vlc_mutex_t processlock;
|
||||
bool thread_handle_valid;
|
||||
bool killed;
|
||||
std::list<HTTPChunkBufferedSource *> chunks;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user