mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-28 17:28:14 +08:00
No need to check for nullptr while deleting
This commit is contained in:
parent
c9d3169dbf
commit
88dc699099
@ -412,10 +412,7 @@ ProfileManager::~ProfileManager()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (auto desc : m_descriptors)
|
for (auto desc : m_descriptors)
|
||||||
{
|
delete desc;
|
||||||
if (desc != nullptr)
|
|
||||||
delete desc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef EASY_MAGIC_STATIC_CPP11
|
#ifndef EASY_MAGIC_STATIC_CPP11
|
||||||
|
@ -249,8 +249,7 @@ EasyHystogramItem::~EasyHystogramItem()
|
|||||||
m_bReady.store(true, ::std::memory_order_release);
|
m_bReady.store(true, ::std::memory_order_release);
|
||||||
if (m_workerThread.joinable())
|
if (m_workerThread.joinable())
|
||||||
m_workerThread.join();
|
m_workerThread.join();
|
||||||
if (m_temporaryImage != nullptr)
|
delete m_temporaryImage;
|
||||||
delete m_temporaryImage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF EasyHystogramItem::boundingRect() const
|
QRectF EasyHystogramItem::boundingRect() const
|
||||||
@ -716,11 +715,8 @@ void EasyHystogramItem::setSource(::profiler::thread_id_t _thread_id, const ::pr
|
|||||||
if (m_workerThread.joinable())
|
if (m_workerThread.joinable())
|
||||||
m_workerThread.join();
|
m_workerThread.join();
|
||||||
|
|
||||||
if (m_temporaryImage != nullptr)
|
delete m_temporaryImage;
|
||||||
{
|
m_temporaryImage = nullptr;
|
||||||
delete m_temporaryImage;
|
|
||||||
m_temporaryImage = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_selectedBlocks.clear();
|
m_selectedBlocks.clear();
|
||||||
::profiler::BlocksTree::children_t().swap(m_selectedBlocks);
|
::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())
|
if (m_workerThread.joinable())
|
||||||
m_workerThread.join();
|
m_workerThread.join();
|
||||||
|
|
||||||
if (m_temporaryImage != nullptr)
|
delete m_temporaryImage;
|
||||||
{
|
m_temporaryImage = nullptr;
|
||||||
delete m_temporaryImage;
|
|
||||||
m_temporaryImage = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_selectedBlocks.clear();
|
m_selectedBlocks.clear();
|
||||||
::profiler::BlocksTree::children_t().swap(m_selectedBlocks);
|
::profiler::BlocksTree::children_t().swap(m_selectedBlocks);
|
||||||
@ -964,11 +957,8 @@ void EasyHystogramItem::updateImage()
|
|||||||
m_workerThread.join();
|
m_workerThread.join();
|
||||||
m_bReady.store(false, ::std::memory_order_release);
|
m_bReady.store(false, ::std::memory_order_release);
|
||||||
|
|
||||||
if (m_temporaryImage != nullptr)
|
delete m_temporaryImage;
|
||||||
{
|
m_temporaryImage = nullptr;
|
||||||
delete m_temporaryImage;
|
|
||||||
m_temporaryImage = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_workerThread = ::std::move(::std::thread([this](HystRegime _regime, qreal _current_scale,
|
m_workerThread = ::std::move(::std::thread([this](HystRegime _regime, qreal _current_scale,
|
||||||
qreal _minimum, qreal _maximum, qreal _range, qreal _value, qreal _width, bool _bindMode,
|
qreal _minimum, qreal _maximum, qreal _range, qreal _value, qreal _width, bool _bindMode,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user