title: Qt QTimer is it safe to stop it this way?
body: <p>Is it safe to stop Qt's timer in it's "timeout" signal/slot function?
  Can't seem to find any information in Qt documentation about the <a href="http://qt-project.org/doc/qt-4.8/qtimer.html#active-prop">QTimer</a>.</p>
  
  <p>I have created a timer that is periodically sending a "keep alive" messages to the server.
  I want this timer to be stopped if there is some kind of error while sending my message.</p>
  
  <pre><code>private:
     QTimer* mpKeepAliveTimer;
  </code></pre>
  
  <p>Timer is initialized like this:</p>
  
  <pre><code>mpKeepAliveTimer = new QTimer(/* this */);
  
  QObject::connect(mpKeepAliveTimer, SIGNAL(timeout()), this, SLOT(OnKeepAlive()));
  
  mpKeepAliveTimer-&gt;start(KEEP_ALIVE_PERIOD);
  </code></pre>
  
  <p>Stopped like this:</p>
  
  <pre><code>if (mpKeepAliveTimer != NULL) // &lt;-- Edited
  {
      if (mpKeepAliveTimer-&gt;isActive() == true)
          mpKeepAliveTimer-&gt;stop();
  
      delete mpKeepAliveTimer;
      mpKeepAliveTimer = NULL;
  }
  </code></pre>
  
  <p>Timeout function looks like this:</p>
  
  <pre><code>void Classname::OnKeepAlive()
  {
     if (isErrorFound == true)
        mpKeepAliveTimer-&gt;stop();   // &lt;---- IS THIS SAFE?
  }
  </code></pre>
  
  <p>Thanks.</p>