1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-12 15:57:57 +00:00

Merge pull request #12427 from Chocobo1/io

Avoid inefficient behavior
This commit is contained in:
Mike Tzou 2020-04-06 12:13:30 +08:00 committed by GitHub
commit 26941a5b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,9 +41,11 @@ Utils::IO::FileDeviceOutputIterator::FileDeviceOutputIterator(QFileDevice &devic
Utils::IO::FileDeviceOutputIterator::~FileDeviceOutputIterator()
{
if (m_device->error() == QFileDevice::NoError)
m_device->write(*m_buffer);
m_buffer->clear();
if (m_buffer.use_count() == 1) {
if (m_device->error() == QFileDevice::NoError)
m_device->write(*m_buffer);
m_buffer->clear();
}
}
Utils::IO::FileDeviceOutputIterator &Utils::IO::FileDeviceOutputIterator::operator=(const char c)