Be careful with QObject:::destroyed signal

Do not dynamic cast or de-reference QObject, since object is either in
destructor or may have already been destroyed.
Merge pull request #998 from DonLakeFlyer/Destroyed

Be careful with QObject:::destroyed signal