]> granicus.if.org Git - icinga2/commitdiff
Fix a crash in ApiClient::TimeoutTimerHandler
authorGunnar Beutner <gunnar@beutner.name>
Thu, 26 Feb 2015 12:30:59 +0000 (13:30 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 26 Feb 2015 12:31:38 +0000 (13:31 +0100)
refs #8485

lib/remote/apiclient.cpp

index f704074d381ab9b90a796da0bb52c5f17729349b..e28148ff4752026ed19d74f0bd99c7976d347837 100644 (file)
@@ -260,6 +260,9 @@ Value RequestCertificateHandler(const MessageOrigin& origin, const Dictionary::P
 void ApiClient::TimeoutTimerHandler(void)
 {
        if (m_Seen < Utility::GetTime() - 60) {
+               /* Obtain a strong reference to ourselves because Disconnect otherwise removes the last reference */
+               ApiClient::Ptr self = this;
+
                Log(LogInformation, "ApiClient")
                    <<  "No messages for identity '" << m_Identity << "' have been received in the last 60 seconds.";
                Disconnect();