title: Qt queued connection of custom object leads to runtime error
body: <p>I am using Qt5.15.2.</p>
  <p>I have a QObject used in my GUI and defined as below:</p>
  <pre><code>#pragma once
  
  #include &quot;actionstep.h&quot;
  #include &quot;anotherthread.h&quot;
  #include &lt;QTableWidget&gt;
  
  class TableWidget : public QTableWidget {
      Q_OBJECT
  
  public:
      TableWidget(QWidget *parent = nullptr) : QTableWidget(4, 4, parent) {
  
          int id = qRegisterMetaType&lt;ActionStep::ActionStatusInfos&gt;();
          std::cout &lt;&lt; id &lt;&lt; std::endl;
  
          connect(this, &amp;TableWidget::SigUpdateActionStatusInfos, this,
                  &amp;TableWidget::SlotUpdateActionStatusInfos,
                  Qt::ConnectionType::QueuedConnection);
  
          th.start();
      }
  
      void methodCalledByAnotherThread(ActionStep::ActionStatusInfos ActionStepInfosObj)
      {
          emit SigUpdateActionStatusInfos(ActionStepInfosObj);
      }
  
  signals:
      void SigUpdateActionStatusInfos(ActionStep::ActionStatusInfos as);
  
  private slots:
      void SlotUpdateActionStatusInfos(ActionStep::ActionStatusInfos as) {
      }
  
  private:
      AnotherThread th;
  };
  </code></pre>
  <p>The idea is to be able to send my custom object of type <code>ActionStep::ActionStatusInfos</code> through the signal/slot service.</p>
  <p>Content of <code>&quot;actionstep.h&quot;</code>, which contains my custom object:</p>
  <pre><code>#pragma once
  #include &lt;iostream&gt;
  #include &lt;QMetaType&gt;
  
  class ActionStep {
  public:
  
      class ActionStatusInfos {
      public:
          // Default constructor
          ActionStatusInfos() : Progress(0) {
          }
  
          // Default destructor
          ~ActionStatusInfos() = default;
  
          // Copy constructor
          ActionStatusInfos(ActionStatusInfos &amp;source) {
              SetProgress(source.GetProgress());
          }
  
          // Copy assignment
          ActionStatusInfos &amp;operator=(ActionStatusInfos &amp;source) {
              SetProgress(source.GetProgress());
              return *this;
          }
  
          // move constructor
          ActionStatusInfos(ActionStatusInfos &amp;&amp;source) noexcept
          {
              SetProgress(source.GetProgress());
          }
  
          //move assignment
          ActionStatusInfos &amp;operator=(ActionStatusInfos &amp;&amp;source) noexcept
          {
              SetProgress(source.GetProgress());
              return *this;
          }
  
          void SetProgress(int pg) {
              Progress = pg;
          }
  
          int GetProgress() {
              return Progress;
          }
  
      private:
          int Progress;
      };
  
  };
  
  Q_DECLARE_METATYPE(ActionStep::ActionStatusInfos)
  
  </code></pre>
  <p>I've added both <code>Q_DECLARE_METATYPE(ActionStep::ActionStatusInfos)</code> and <code>qRegisterMetaType&lt;ActionStep::ActionStatusInfos&gt;()</code>, and my class seems to meet the minimum requirements needed by Qt for registering a custom class (default ctor, dtor and copy ctor).</p>
  <p>At runtime, <code>methodCalledByAnotherThread</code> is called by a different thread than the GUI. After a few cycles, I get a SIGFAULT, and the debugger shows that there is a dangling reference when the Qt stuff is executed.</p>
  <p>Am I missing something obvious?</p>