I'm running in an application crash. gdb's complaining about segmentation fault in QObject::thread (this=(incomplete type)). Here's the code where I suspect the problem is coming from:

Qt Code:
  1. #include <QtDebug>
  2. #include <QtGUI>
  3. #include <QPainter>
  4. #include <QThread>
  5. #include "webcam.h"
  6. #include "capturingthread.h"
  7. #include "imagebuffer.h"
  8. #include "renderingthread.h"
  9.  
  10. WebcamWidget::WebcamWidget(QWidget *parent) : QWidget(parent)
  11. {
  12. setupUi(this);
  13.  
  14. pWaitCondition = &waitCondition;
  15. imageBuffer = new ImageBuffer(pWaitCondition);
  16. capturingThread = new CapturingThread(imageBuffer);
  17. renderingThread = new RenderingThread(imageBuffer,pWaitCondition);
  18.  
  19. qRegisterMetaType<QImage>("QImage&");
  20. connect(renderingThread, SIGNAL(renderingDone(QImage& )), this, SLOT(updatePixmap(QImage& )));
  21. connect(startButton, SIGNAL(clicked()), this, SLOT(startThreads()));
  22. }
  23.  
  24. WebcamWidget::~WebcamWidget()
  25. {
  26. delete imageBuffer;
  27. delete capturingThread;
  28. delete renderingThread;
  29. }
  30.  
  31. void WebcamWidget::startThreads()
  32. {
  33. if (capturingThread->isRunning())//&&renderingThread->isRunning())
  34. {
  35. capturingThread->haltCapture();
  36. renderingThread->haltRendering();
  37. startButton->setText("Start");
  38. }
  39. else
  40. {
  41. capturingThread->start();
  42. renderingThread->start();
  43. startButton->setText("Stop");
  44. }
  45. }
  46.  
  47. void WebcamWidget::haltThreads()
  48. {
  49. capturingThread->haltCapture();
  50. renderingThread->haltRendering();
  51. }
  52.  
  53. void WebcamWidget::paintEvent(QPaintEvent*)
  54. {
  55. QPainter painter(this);
  56. painter.fillRect(rect(), Qt::black);
  57. if (pixmap.isNull())
  58. {
  59. qDebug()<<"W: Pixmap data null.";
  60. painter.setPen(Qt::black);
  61. painter.drawText(rect(), Qt::AlignCenter, "No Image Feed");
  62. return;
  63. }
  64. painter.drawPixmap(10,10,pixmap);
  65. qDebug()<<"Painting successful.";
  66. }
  67.  
  68. void WebcamWidget::updatePixmap(QImage& image)
  69. {
  70. qDebug()<<"WebcamWidget::updatePixmap() invoked.";
  71. pixmap = QPixmap::fromImage(image);
  72. update();
  73. }
To copy to clipboard, switch view to plain text mode 

I only used this in this .cpp file and I don't see this anywhere in my spawned threads' codes. Did I not use it right? TIA.