fix potential double lock of jpeg mutex
This commit is contained in:
parent
1a54a96c04
commit
fc541ac57d
|
@ -1090,14 +1090,16 @@ bool Image::WriteJpeg(const std::string &filename,
|
|||
const int &quality_override,
|
||||
SystemTimePoint timestamp,
|
||||
bool on_blocking_abort) const {
|
||||
// jpeg libs are not thread safe
|
||||
std::unique_lock<std::mutex> lck(jpeg_mutex);
|
||||
|
||||
if (config.colour_jpeg_files && (colours == ZM_COLOUR_GRAY8)) {
|
||||
Image temp_image(*this);
|
||||
temp_image.Colourise(ZM_COLOUR_RGB24, ZM_SUBPIX_ORDER_RGB);
|
||||
return temp_image.WriteJpeg(filename, quality_override, timestamp, on_blocking_abort);
|
||||
}
|
||||
|
||||
// jpeg libs are not thread safe
|
||||
std::unique_lock<std::mutex> lck(jpeg_mutex);
|
||||
|
||||
int quality = quality_override ? quality_override : config.jpeg_file_quality;
|
||||
|
||||
jpeg_compress_struct *cinfo = writejpg_ccinfo[quality];
|
||||
|
|
Loading…
Reference in New Issue