mtnbiker66
11th February 2013, 18:10
All --
Just doing some testing to verify that my app works correctly in Windows and Mac, and just noticed that the following code in my mainwindow.cpp works exactly as I expect on my Mac (where I do my primary development), but the same code does not generate the dialog and throws the following error: "QDialog::exec: Recursive call detected" because the dialog isn't created. As this code was written a year ago I'm having trouble believing that I've missed this before but that's another story...
mainwindow.h
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
RAOEntryDialog *RAO_Edit;
};
mainwindow.cpp
//************************************************** **************************
void MainWindow::on_SurgePB_clicked()
{
//**********************************************
//* Create a pop-up dialog to allow the user *
//* to perform large-scale editing of period *
//* and phase data related to RAOs... *
//**********************************************
if (!RAO_Edit)
{
RAO_Edit = new RAOEntryDialog(surgemodel, "SURGE", user, rig_id,
rig_dataset, this);
connect(RAO_Edit, SIGNAL(edit_rao_signal(int)),
this, SLOT(process_rao_edits(int)));
}
RAO_Edit->exec();
}
If instead of the "if" statement I simply create the dialog then delete it after the "exec()" command it works fine - and that's probably a better way of preventing memory leaks anyway - but I was wondering if someone has a theory of why there's a different behavior on the different platforms (Windows 7 and Mac 10.7.5)
thanks!
Kodi
Just doing some testing to verify that my app works correctly in Windows and Mac, and just noticed that the following code in my mainwindow.cpp works exactly as I expect on my Mac (where I do my primary development), but the same code does not generate the dialog and throws the following error: "QDialog::exec: Recursive call detected" because the dialog isn't created. As this code was written a year ago I'm having trouble believing that I've missed this before but that's another story...
mainwindow.h
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
RAOEntryDialog *RAO_Edit;
};
mainwindow.cpp
//************************************************** **************************
void MainWindow::on_SurgePB_clicked()
{
//**********************************************
//* Create a pop-up dialog to allow the user *
//* to perform large-scale editing of period *
//* and phase data related to RAOs... *
//**********************************************
if (!RAO_Edit)
{
RAO_Edit = new RAOEntryDialog(surgemodel, "SURGE", user, rig_id,
rig_dataset, this);
connect(RAO_Edit, SIGNAL(edit_rao_signal(int)),
this, SLOT(process_rao_edits(int)));
}
RAO_Edit->exec();
}
If instead of the "if" statement I simply create the dialog then delete it after the "exec()" command it works fine - and that's probably a better way of preventing memory leaks anyway - but I was wondering if someone has a theory of why there's a different behavior on the different platforms (Windows 7 and Mac 10.7.5)
thanks!
Kodi