From 34bf3b4833bcded73646ee5c702dfae52fb8f86b Mon Sep 17 00:00:00 2001 From: Henrik Kinnunen Date: Sun, 20 Feb 2011 15:48:42 +0100 Subject: Fixed a possible crash when using a slot m_holder = 0 --- src/FbTk/Slot.hh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/FbTk/Slot.hh b/src/FbTk/Slot.hh index ba3cfc4..9080d53 100644 --- a/src/FbTk/Slot.hh +++ b/src/FbTk/Slot.hh @@ -229,7 +229,8 @@ public: } void operator()() { - reinterpret_cast(m_holder->m_callback)( m_holder ); + if (m_holder) + reinterpret_cast(m_holder->m_callback)( m_holder ); } }; @@ -247,7 +248,8 @@ public: } void operator()(Arg1 arg) { - reinterpret_cast(m_holder->m_callback)(m_holder, arg); + if (m_holder) + reinterpret_cast(m_holder->m_callback)(m_holder, arg); } }; @@ -265,7 +267,8 @@ public: } void operator()(Arg1 arg1, Arg2 arg2) { - reinterpret_cast(m_holder->m_callback)(m_holder, arg1, arg2); + if (m_holder) + reinterpret_cast(m_holder->m_callback)(m_holder, arg1, arg2); } }; @@ -282,8 +285,9 @@ public: } void operator()(Arg1 arg1, Arg2 arg2, Arg3 arg3) { - reinterpret_cast(m_holder->m_callback) - ( m_holder, arg1, arg2, arg3 ); + if (m_holder) + reinterpret_cast(m_holder->m_callback) + ( m_holder, arg1, arg2, arg3 ); } }; -- cgit v0.11.2