I am trying to send a DDS module with the signal-slot method. My program crashes to segmentation fault when it executes the emit signal command. The part of the code where it crashes is inside the moc file and it is:

moc_myclass.cpp:
Qt Code:
  1. // SIGNAL 0
  2. void MyClass::MySignal(DDSModule::Message & _t1)
  3. {
  4. void *_a[] = { Q_NULLPTR, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
  5. QMetaObject::activate(this, &staticMetaObject, 0, _a);
  6. }
To copy to clipboard, switch view to plain text mode 

I have tried to commenting out the connect() part, but the program still crashes so I'm guessing it has something to do with the data I am trying to send. The main code is shown below.

myclass.h:
Qt Code:
  1. class MyClass: public QThread
  2. {
  3. Q_OBJECT
  4.  
  5. signals:
  6. void MySignal(DDSModule::Message &message);
  7.  
  8. public:
  9. MyClass();
  10. void ddsMessageHandler(DDSModule::Message &message);
  11.  
  12. protected:
  13. virtual void run();
  14.  
  15. private:
  16. // Random attributes
  17. };
To copy to clipboard, switch view to plain text mode 


myclass.cpp:
Qt Code:
  1. void MyClass::ddsMessageHandler(DDSModule::Message &message)
  2. {
  3. emit MySignal(message);
  4. }
  5.  
  6. MyClass::MyClass()
  7. {
  8. }
To copy to clipboard, switch view to plain text mode 

ddshandler.h:
Qt Code:
  1. class DDSHandler : public QThread
  2. {
  3.  
  4. Q_OBJECT
  5.  
  6. public:
  7. DDSHandler();
  8. signals:
  9.  
  10. void DDSDataSend(MyOtherClass *newObject);
  11.  
  12. public slots:
  13.  
  14. void handleDDSData(DDSModule::Message &message);
  15.  
  16. private:
  17. void run();
  18.  
  19. MyClass *myClass_;
  20. };
To copy to clipboard, switch view to plain text mode 


ddshandler.cpp:
Qt Code:
  1. DDSHandler::DDSHandler()
  2. {
  3. myClass_ = new MyClass;
  4. myClass_->start();
  5.  
  6. qRegisterMetaType<DDSModule::Message &message>("DDSModule::Message &message");
  7.  
  8. connect(myClass_, SIGNAL(DDSDataReady(DDSModule::Message &message)),
  9. this, SLOT(handleDDSData(DDSModule::Message &message)));
  10. }
  11.  
  12. void DDSHandler::handleDDSData(DDSModule::Message &message)
  13. {
  14. myOtherClass *messageInNewForm = processMessage(DDSModule::Message &message);
  15.  
  16. emit DDSDataSend(*messageInNewForm)
  17. }
To copy to clipboard, switch view to plain text mode 


Is there any restrictions on what type of data I can send with the emit signal? The message that comes to the ddsMessageHandler() is valid. I have also tried removing the reference markers (&) but it doesn't have any effect either.