Hi,
I've had a problem with a thread that crash systematically as it exited. It seems it does so when it tries to notify its parent of its exit.
So I changed the code in thread.cpp from
if ( ... && th->_parent )
th->_parent->Notify(...)
to
if ( ... && th->_parent->isThread() )
th->_parent->Notify(...)
I'm not sure why a pointer was used instead of a boolean in the first place.
Anyway it works for me but I'm not sure I fully understand what's happening.
Did anyone go through the same problem? Any ideas?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just off hand, I'd say that the th->_parent test was there to make sure that you don't dereference a null-pointer on the next line. In that case, your change will cause a segmentation violation instead.
If your changed seemed to help, then you ought to -add- the new condition to the end of the if, rather than replacing the old one.
BTW: Don't forget to mention a platform. The code is different on Win32 vs Posix.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've had a problem with a thread that crash systematically as it exited. It seems it does so when it tries to notify its parent of its exit.
So I changed the code in thread.cpp from
if ( ... && th->_parent )
th->_parent->Notify(...)
to
if ( ... && th->_parent->isThread() )
th->_parent->Notify(...)
I'm not sure why a pointer was used instead of a boolean in the first place.
Anyway it works for me but I'm not sure I fully understand what's happening.
Did anyone go through the same problem? Any ideas?
Thanks.
Just off hand, I'd say that the th->_parent test was there to make sure that you don't dereference a null-pointer on the next line. In that case, your change will cause a segmentation violation instead.
If your changed seemed to help, then you ought to -add- the new condition to the end of the if, rather than replacing the old one.
BTW: Don't forget to mention a platform. The code is different on Win32 vs Posix.
You're definetly right about the null-pointer, took that for guranted. Thanks for the reminder.