title: Qt delete works with Valgrind but not normal execution
body: <p>I'm checking for memory leaks in my Qt program using QtCreator and Valgrind. I am deleting a few entries in a QHash in my destructor like this:</p>
  
  <pre><code>QHash&lt;QString, QVariant*&gt; m_Hash;
  
  /**
   * @brief
   * Destruct a Foo Class instance
   */
  Foo ::~Foo ()
  {
  
      // Do Cleanup here
  
      // Delete hash leftovers
      foreach( QString key, m_Hash.keys() )
      {
  
          qDebug() &lt;&lt; "Deleting an entry..";
  
          // Delete the hash item
          delete m_Hash.take(key);
  
      }
  
  }
  </code></pre>
  
  <p>If I debug with Valgrind this code is fine and deletes the contents when the destructor is called:</p>
  
  <pre><code>&gt;&gt; Deleting an entry.. 
  &gt;&gt; Deleting an entry.. 
  </code></pre>
  
  <p>If I launch with GDB within QtCreator, launch without GDB from QtCreator, or just run my Qt App from the command line I get Segmentation Faults!</p>
  
  <pre><code>Signal name : 
  SIGSEGV
  Signal meaning : 
  Segmentation fault
  </code></pre>
  
  <p>If I commend out the 'delete' line then I can run my app just fine using any method but I do leak memory.</p>
  
  <p>What gives? Does valgrind introduce some sort of delay that allows my destructor to work? How can I solve this?</p>