View Full Version : Crash on connect

3rd May 2013, 14:32
Hi all,

I have a crash on connect in constructor

BuilderAppInstanceUI::BuilderAppInstanceUI(const Workflow &wf)
connect(Datasets, SIGNAL(currentItemChanged(QListWidgetItem*,QListWi dgetItem*)), Variables, SLOT(datasetChanged(QListWidgetItem*,QListWidgetIt em*)));

Datasets and
Variables two members of

class BuilderAppInstanceUI : public QWidget
, public ObserverAdapter

BuilderAppInstanceUI(const Workflow &workflow);

void retranslateUi(QWidget *Form);
void setupUi(QWidget *Form);

QStackedWidget *stackedWidget;

BuilderAppListWidget *Datasets;
QTreeWidget *Variables;

private slots:
void datasetChanged(QListWidgetItem* current, QListWidgetItem* previous);


BuilderAppListWidget inherits from
QListWidget and as such can emit this signal
SIGNAL(currentItemChanged(QListWidgetItem*,QListWi dgetItem*))

class BuilderAppListWidget : public QListWidget

BuilderAppListWidget (QWidget* qwdgt = nullptr);
~BuilderAppListWidget (){};

void dragEnterEvent( QDragEnterEvent * event ) ;
void dragMoveEvent( QDragMoveEvent * event ) ;
void dropEvent( QDropEvent * event );
void keyReleaseEvent( QKeyEvent * event ) final ;

BuilderAppInstanceUI* m_instance ;


Should I declare explicitly
currentItemChanged in body for
BuilderAppListWidget class ? If not, where does problem come from ?


Santosh Reddy
3rd May 2013, 16:46
datasetChanged is a slot of BuilderAppInstanceUI (not Variables), the connect should look like

connect(Datasets, SIGNAL(currentItemChanged(QListWidgetItem*,QListWi dgetItem*)), this, SLOT(datasetChanged(QListWidgetItem*,QListWidgetIt em*)));

3rd May 2013, 18:44
datasetChanged is a slot of BuilderAppInstanceUI (not Variables), the connect should look like

This wouldn't cause a crash, Qt would simply complain that the slot didn't exist.

However, if the code posted for the BuilderAppInstanceUI constructor is the whole thing, then the "Datasets" and "Variables" members have not been initialized prior to the connect() so they point to random locations in memory, not to actual instances of the widgets they represent. This would most certainly cause the crash as Qt attempts to resolve the meta-objects in the connect() method's execution.