Ref T786 Fixed dangling pointer in CSlot::singleShot

This commit is contained in:
Mat Sutcliffe
2020-04-21 16:02:34 +01:00
parent 5678052b5d
commit 26bd157551

View File

@@ -108,11 +108,7 @@ namespace BlackMisc
{
// does NOT return the values of m_function!
if (!m_object || !m_function) { return false; }
QTimer::singleShot(0, m_object.data(), [ = ]
{
if (!m_object || !m_function) { return; }
m_function(args...);
});
QTimer::singleShot(0, m_object.data(), std::bind(*this, std::forward<Args>(args)...));
return true;
}