Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED] new QDialog crash

    General and Desktop
    2
    2
    729
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Munteanu Marian last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • A
        ambershark last edited by

        What is the stack trace of the crash?

        Oh and why is this marked as solved?

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply Reply Quote 0
        • First post
          Last post