title: Plugin exposing member `QWidget` result in pointer being freed was not allocated
body: <p>I'm trying to develop a plugin which exposes a <code>QWidget</code> (more details <a href="https://stackoverflow.com/questions/38623813/declare-a-plugin-class-that-inherits-from-qwidget">here</a>), it's interface has something like:</p>
  
  <pre><code>virtual QWidget *panel() = 0;
  </code></pre>
  
  <p>While in the implementation I tried:</p>
  
  <pre><code>QWidget *BPlugin::panel() {
      return &amp;m_widget;
  }
  </code></pre>
  
  <p>This gives an error, app crashes on close: </p>
  
  <pre><code>malloc: *** error for object 0x7f9db24c3f78: pointer being freed was not allocated
  </code></pre>
  
  <p>Instead, allocating <code>QWidget</code> with <code>new</code> works fine. But using <code>new</code> these days isn't that popular anymore. Should I use <code>new</code> anyway when dealing with plugins?</p>