title: Qt emit signal std::string parameter debug
body: <p>I'm having an issue when strings are used in Qt signal-slot. For some reason the slot function is not getting the value whenever a signal with string parameter is involved. I've pasted relevant pieces of code below and Qt Creator debug session screenshots for details -</p>
  
  <p>Class HradDelegate:</p>
  
  <pre><code>void HradDelegate::OnSsnChanged(std::string param) {
    qDebug() &lt;&lt; "HradDelegate::OnSsnChanged() " &lt;&lt; param.c_str();
    emit ssnChanged(param);
  }
  </code></pre>
  
  <p>As you can notice <code>param</code> is <code>WBMP-FM</code>, when breakpoint is set after <code>qDebug()</code> line,</p>
  
  <p><a href="https://i.stack.imgur.com/PCHEW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PCHEW.png" alt="enter image description here"></a></p>
  
  <p>Class MainWindow:</p>
  
  <pre><code>void MainWindow::init() {
    qRegisterMetaType&lt;std::string&gt;("std::string");
    connect(m_HradDelegate, SIGNAL(ssnChanged(std::string)), this, SLOT(OnSsnChanged(std::string)));
  }
  
  void MainWindow::OnSsnChanged(std::string param) {
    qDebug() &lt;&lt; "MainWindow::OnSsnChanged() " &lt;&lt; param.c_str();
    // extra code removed for clarity
  }
  </code></pre>
  
  <p>When breakpoint is set after <code>qDebug()</code> line,</p>
  
  <p><a href="https://i.stack.imgur.com/U7M7z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U7M7z.png" alt="enter image description here"></a></p>
  
  <p>Now the value of <code>param</code> is garbage in <code>MainWindow::OnSsnChanged()</code> and I get a segmentation fault error.</p>
  
  <p>The project compiles for multi platforms. It works fine on Ubuntu 14.04/16.04 and OS X. When I compile and run on ARM7hf, I see the error above and it happens to all the signals involving <code>std::string</code>.</p>
  
  <p>Is there something that I missed?</p>
  
  <p>Thanks.</p>