I am trying to open a new dialog from a button click inside the mainwindow.
My code is as follows:
Qt Code:
  1. void MainWindow::on_btn_login_clicked()
  2. {
  3. if (count == 1)
  4. {
  5. dialog->show();
  6. dialog->raise();
  7. dialog->activateWindow();
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 
My Mainwindow .h is as follows:
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include "dialog.h"
  6. namespace Ui {
  7. class MainWindow;
  8. }
  9.  
  10. class MainWindow : public QMainWindow
  11. {
  12. Q_OBJECT
  13.  
  14. public:
  15. explicit MainWindow(QWidget *parent = 0);
  16. ~MainWindow();
  17.  
  18. private slots:
  19. void on_btn_magnifier_clicked();
  20.  
  21. void on_btn_login_clicked();
  22. private:
  23. Ui::MainWindow *ui;
  24. Dialog *dialog;
  25. };
  26.  
  27. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

I have made a new form named dialog.ui with dialog.cpp and dialog.h
When i am debugging the application,segmentation fault is coming on the line:
Qt Code:
  1. dialog->show();
To copy to clipboard, switch view to plain text mode