I am not the best at debugging yet, so I am struggling to figure this one out. I am trying to use a custom class based on QTableView. It compiles ok, but when I try to run the program I get the following segfault:

[Thread debugging using libthread_db enabled]
[New Thread 0xb67e86c0 (LWP 23223)]
[New Thread 0xb5b97b90 (LWP 23226)]
[Thread 0xb5b97b90 (LWP 23226) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb67e86c0 (LWP 23223)]
0xb77477fd in QWidget::~QWidget () from /usr/lib/libQtGui.so.4
I don't really know where to start... here is my super simple subclassed QTableView...

Qt Code:
  1. #ifndef APPOINTMENTBOOK_H
  2. #define APPOINTMENTBOOK_H
  3.  
  4. #include <QtCore>
  5. #include <QTableView>
  6.  
  7. class AppointmentBook : public QTableView
  8. {
  9. Q_OBJECT
  10.  
  11. public:
  12. AppointmentBook(QWidget *parent = 0);
  13.  
  14. protected:
  15. void paintEvent(QPaintEvent *event);
  16.  
  17. };
  18.  
  19. #endif
To copy to clipboard, switch view to plain text mode 

and the cpp...

Qt Code:
  1. #include <QtGui>
  2. #include <QTableView>
  3. #include "appointmentbook.h"
  4.  
  5. AppointmentBook::AppointmentBook(QWidget *parent)
  6. : QTableView(parent)
  7. {
  8. //QTimer *timer = new QTimer(this);
  9. //connect(timer, SIGNAL(timeout()), this, SLOT(update()));
  10. //timer->start(1000);
  11.  
  12. //setWindowTitle(tr("Appointment Book"));
  13. //resize(200, 200);
  14.  
  15. }
  16.  
  17. void AppointmentBook::paintEvent(QPaintEvent *)
  18. {
  19.  
  20. //QColor secondColor(208, 22, 13, 255);
  21.  
  22. //QTime time = QTime::currentTime();
  23.  
  24. //QPainter painter(this);
  25. //painter.setRenderHint(QPainter::Antialiasing);
  26. //painter.scale(width(), height() / 86400.0);
  27.  
  28. //painter.setPen(Qt::NoPen);
  29.  
  30.  
  31. //painter.setPen(secondColor);
  32.  
  33. //int lineY = (time.hour()*60*60) + (time.minute()*60) + time.second();
  34. //painter.drawLine(0, lineY, width(), lineY);
  35.  
  36. }
To copy to clipboard, switch view to plain text mode 

As you can see it is all commented out because I can't figure out what's going on.