0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-28 01:04:41 +08:00

No need to check for nullptr while deleting

This commit is contained in:
Victor Zarubkin 2016-12-08 22:19:45 +03:00
parent c9d3169dbf
commit 88dc699099
2 changed files with 8 additions and 21 deletions

View File

@ -412,11 +412,8 @@ ProfileManager::~ProfileManager()
#endif
for (auto desc : m_descriptors)
{
if (desc != nullptr)
delete desc;
}
}
#ifndef EASY_MAGIC_STATIC_CPP11
class ProfileManagerInstance {

View File

@ -249,7 +249,6 @@ EasyHystogramItem::~EasyHystogramItem()
m_bReady.store(true, ::std::memory_order_release);
if (m_workerThread.joinable())
m_workerThread.join();
if (m_temporaryImage != nullptr)
delete m_temporaryImage;
}
@ -716,11 +715,8 @@ void EasyHystogramItem::setSource(::profiler::thread_id_t _thread_id, const ::pr
if (m_workerThread.joinable())
m_workerThread.join();
if (m_temporaryImage != nullptr)
{
delete m_temporaryImage;
m_temporaryImage = nullptr;
}
m_selectedBlocks.clear();
::profiler::BlocksTree::children_t().swap(m_selectedBlocks);
@ -799,11 +795,8 @@ void EasyHystogramItem::setSource(::profiler::thread_id_t _thread_id, ::profiler
if (m_workerThread.joinable())
m_workerThread.join();
if (m_temporaryImage != nullptr)
{
delete m_temporaryImage;
m_temporaryImage = nullptr;
}
m_selectedBlocks.clear();
::profiler::BlocksTree::children_t().swap(m_selectedBlocks);
@ -964,11 +957,8 @@ void EasyHystogramItem::updateImage()
m_workerThread.join();
m_bReady.store(false, ::std::memory_order_release);
if (m_temporaryImage != nullptr)
{
delete m_temporaryImage;
m_temporaryImage = nullptr;
}
m_workerThread = ::std::move(::std::thread([this](HystRegime _regime, qreal _current_scale,
qreal _minimum, qreal _maximum, qreal _range, qreal _value, qreal _width, bool _bindMode,