[SOLVED] new QDialog crash



  • The problem was in another part of the code.

    Hi, what is wrong with the following code?

    @
    class MyDialog : public QDialog
    {
    Q_OBJECT
    public:
    explicit MyDialog(QWidget *parent = 0);
    ~MyDialog();
    };
    MyDialog::MyDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MyDialog)
    {
    ui->setupUi(this);
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT
    MyDialog * md;
    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    };
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    md = new MyDialog(this); // THIS LINE GENERATE A CRASH
    //MyDialog md(this); is OK

    }
    @

    Thank you.



  • What is the stack trace of the crash?

    Oh and why is this marked as solved?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.