
Originally Posted by
high_flyer
a full clean and a rebuild might also help.
I've tried that the first time I encountered the problem.
Meanwhile i was able to pinpoint the problem. This is the first time I use modeless dialogs and I was copying the qt documentation example
void EditorWindow::find()
{
if (!findDialog) {
findDialog = new FindDialog(this);
connect(findDialog, SIGNAL(findNext()), this, SLOT(findNext()));
}
findDialog->show();
findDialog->raise();
findDialog->activateWindow();
}
void EditorWindow::find()
{
if (!findDialog) {
findDialog = new FindDialog(this);
connect(findDialog, SIGNAL(findNext()), this, SLOT(findNext()));
}
findDialog->show();
findDialog->raise();
findDialog->activateWindow();
}
To copy to clipboard, switch view to plain text mode
so I have a slot in my mainwindow
void MainWindow::select_singlevaluesfields()
{
if(!channelldialog){
channelldialog=new channelWindow(this);
channelldialog->cil=&cil;
channelldialog->nchannels=nchannels;
channelldialog->fillsinglevalues();
}
x.setTimeSpec(Qt::UTC); y.setTimeSpec(Qt::UTC);
GetTimeInterface(&x,&y);
channelldialog->Itime=x;
channelldialog->Ltime=y;
channelldialog->setTimeInterface(x,y);
channelldialog->show();
channelldialog->raise();
channelldialog->activateWindow();
}
void MainWindow::select_singlevaluesfields()
{
if(!channelldialog){
channelldialog=new channelWindow(this);
channelldialog->cil=&cil;
channelldialog->nchannels=nchannels;
channelldialog->fillsinglevalues();
}
QDateTime x,y;
x.setTimeSpec(Qt::UTC); y.setTimeSpec(Qt::UTC);
GetTimeInterface(&x,&y);
channelldialog->Itime=x;
channelldialog->Ltime=y;
channelldialog->setTimeInterface(x,y);
channelldialog->show();
channelldialog->raise();
channelldialog->activateWindow();
}
To copy to clipboard, switch view to plain text mode
and in mainwindow .h I have defined
channelWindow *channelldialog;
channelWindow *channelldialog;
To copy to clipboard, switch view to plain text mode
It seems that sometimes the test !channelldialog is always false even in the first call (this occurs anytime I have also a QTimer pointer in the main window) so any uses of the channelldialog points to nowhere and the segfault. the problem goes away is i do not rely in the if(!channelldialog) condition test and add the channelldialog=new channelWindow(this); in the mainwindow constructor.
Added after 6 minutes:
oops, I've just noticed there is a huge difference between my code and the qt code example. My bad.
Bookmarks