Results 1 to 2 of 2

Thread: qt program unexpectedly finished.

  1. #1
    Join Date
    Jun 2014
    Posts
    16
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default qt program unexpectedly finished.

    Hi to all, I've centos 6.4 in VM and Qt 5.3.2. I am trying to build SDI app. fallowing is the code:-
    sdiapMainwindow.pro:-

    Qt Code:
    1. QT += core gui
    2.  
    3. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    4.  
    5. TARGET = sdiapp
    6. TEMPLATE = app
    7.  
    8.  
    9. SOURCES += main.cpp\
    10. sdiappmainwindow.cpp
    11.  
    12. HEADERS += sdiappmainwindow.h
    13.  
    14. FORMS += sdiappmainwindow.ui
    15.  
    16. RESOURCES += \
    17. sdimainiwndow_rsc.qrc
    To copy to clipboard, switch view to plain text mode 
    sdiappMainwindow.h:-

    Qt Code:
    1. #ifndef SDIAPPMAINWINDOW_H
    2. #define SDIAPPMAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5.  
    6. namespace Ui {
    7. class sdiappMainWindow;
    8. }
    9.  
    10. class sdiappMainWindow : public QMainWindow
    11. {
    12. Q_OBJECT
    13.  
    14. private slots:
    15. void newfile();
    16. void helpAbout();
    17.  
    18. protected:
    19.  
    20. void closeEvent(QCloseEvent *event);
    21. bool isSafeToClose();
    22. public:
    23. explicit sdiappMainWindow(QWidget *parent = 0);
    24. ~sdiappMainWindow();
    25.  
    26. void connectActions();
    27. private:
    28. Ui::sdiappMainWindow *ui;
    29. };
    30.  
    31. #endif // SDIAPPMAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 
    sdiappMainwindow.cpp :-
    ----------------------------

    Qt Code:
    1. #include "sdiappmainwindow.h"
    2. #include "ui_sdiappmainwindow.h"
    3. #include <QMessageBox>
    4. #include <QApplication>
    5.  
    6. #include <QCloseEvent>
    7.  
    8. sdiappMainWindow::sdiappMainWindow(QWidget *parent) :
    9. QMainWindow(parent),
    10. ui(new Ui::sdiappMainWindow)
    11. {
    12. ui->setupUi(this);
    13.  
    14. setAttribute(Qt::WA_DeleteOnClose);
    15. setWindowTitle(QString("%1[*] %2").arg("unamed - ").arg("SDI"));
    16. connect(ui->textEditSDIMainWindow->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool)) );
    17.  
    18. connectActions();
    19. }
    20. void sdiappMainWindow::closeEvent(QCloseEvent *event)
    21. {
    22. if( isSafeToClose())
    23. event->accept();
    24. else
    25. event->ignore();
    26. }
    27.  
    28. bool sdiappMainWindow::isSafeToClose()
    29. {
    30. if(isWindowModified())
    31. {
    32. switch(QMessageBox::warning(this, "SDI", "the window has unsaved changes\n"
    33. " do you want to save changes before it is closed", QMessageBox::Discard | QMessageBox::Cancel))
    34. {
    35. case QMessageBox::Cancel : return false; break;
    36. default : return true;
    37. }
    38. }
    39. return true;
    40. }
    41.  
    42. void sdiappMainWindow::connectActions()
    43. {
    44. connect( ui->actionE_xtit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()) );
    45. connect( ui->action_Close, SIGNAL(triggered()), this, SLOT(close()) );
    46. }
    47.  
    48.  
    49.  
    50. sdiappMainWindow::~sdiappMainWindow()
    51. {
    52. delete ui;
    53. }
    54.  
    55. void sdiappMainWindow::newfile()
    56. {
    57. (new sdiappMainWindow())->show();
    58. }
    59.  
    60. void sdiappMainWindow::helpAbout()
    61. {
    62.  
    63. }
    To copy to clipboard, switch view to plain text mode 
    inteface is :
    sdimainwnd.png
    this code runs successfully bit when closing it show following error :-
    -----------------------------------------------------------------------------
    ouotput is:-
    Qt Code:
    1. Starting /opt/project/qt/build-sdiapp-Desktop_Qt_5_3_GCC_64bit-Debug/sdiapp...
    2.  
    3. (<unknown>:125658): Gtk-WARNING **: Attempt to load unknown IM context type 'gtk-im-context-none'
    4. *** glibc detected *** /opt/project/qt/build-sdiapp-Desktop_Qt_5_3_GCC_64bit-Debug/sdiapp: munmap_chunk(): invalid pointer: 0x00007fffeb1757e0 ***
    5. ======= Backtrace: =========
    6. /lib64/libc.so.6[0x36694760e6]
    7. /opt/project/qt/build-sdiapp-Desktop_Qt_5_3_GCC_64bit-Debug/sdiapp[0x405f46]
    8. /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5(_ZN7QObject5eventEP6QEvent+0x438)[0x7f4f908dca08]
    9. /opt/Qt/5.3/gcc_64/lib/libQt5Widgets.so.5(_ZN7QWidget5eventEP6QEvent+0xc2)[0x7f4f915b24d2]
    10. /opt/Qt/5.3/gcc_64/lib/libQt5Widgets.so.5(_ZN11QMainWindow5eventEP6QEvent+0x7b)[0x7f4f916d42cb]
    11. /opt/Qt/5.3/gcc_0x616)[0x7f4f9157dd46]
    12. ............
    13. /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5(_ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent+0x84)[0x7f4f908a8fc4]
    14. /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5(_ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData+0x258)[0x7f4f908abb48]
    15. /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5(+0x329253)[0x7f4f90903253]
    16. /lib64/libglib-2.0.so.0(g_main_context_dispatch+0x22e)[0x366a838f0e]
    17. /lib64/libglib-2.0.so.0[0x366a83c938]
    18. /lib64/libglib-2.0.so.0(g_main_context_iteration+0x7a)[0x366a83ca3a]
    19. /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5(_ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x64)[0x7f4f90903684]
    20. /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5(_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE+0xcb)[0x7f4f908a71db]
    21. /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5(_ZN16QCoreApplication4execEv+0x85)[0x7f4f908ac0a5]
    22. /opt/project/qt/build-sdiapp-Desktop_Qt_5_3_GCC_64bit-Debug/sdiapp[0x405994]
    23. /lib64/libc.so.6(__libc_start_main+0xfd)[0x366941ecdd]
    24. /opt/project/qt/build-sdiapp-Desktop_Qt_5_3_GCC_64bit-Debug/sdiapp[0x405889]
    25. ======= Memory map: ========
    26.  
    27. .....
    28. 7f4f863cd000-7f4f8640e000 rw-p 00000000 00:00 0
    29. 7f4f8640e000-7f4f86450000 r-xp 00000000 08:03 1593842 /opt/Qt/5.3/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so
    30. 7f4f86450000-7f4f8664f000 ---p 00042000 08:03 1593842 /opt/Qt/5.3/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so
    31. 7f4f8664f000-7f4f86651000 r--p 00041000 08:03 1593842 /opt/Qt/5.3/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so
    32. 7f4f86651000-7f4f86652000 rw-p 00043000 08:03 1593842 /opt/Qt/5.3/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so
    33. 7f4f86652000-7f4f866af000 r-xp 00000000 08:03 140781 /lib64/libfreebl3.so
    34. 7f4f866af000-7f4f868ae000 ---p 0005d000 08:03 140781 /lib64/libfreebl3.so
    35. 7f4f868ae000-7f4f868af000 r--p 0005c000 08:03 140781 /lib64/libfreebl3.so
    36. 7f4f868af000-7f4f868b0000 rw-p 0005d000 08:03 140781 /lib64/libfreebl3.so
    37. 7f4f868b0000-7f4f868b4000 rw-p 00000000 00:00 0
    38. 7f4f868b4000-7f4f868bb000 r-xp 00000000 08:03 140782 /lib64/libcrypt-2.12.so
    39. 7f4f868bb000-7f4f86abb000 ---p 00007000 08:03 140782 /lib64/libcrypt-2.12.so
    40. 7f4f86abb000-7f4f86abc000 r--p 00007000 08:03 140782 /lib64/libcrypt-2.12.so
    41. 7f4f86abc000-7f4f86abd000 rw-p 00008000 08:03 140782 /lib64/libcrypt-2.12.so
    42. 7f4f86abd000-7f4f86aeb000 rw-p 00000000 00:00 0
    43. 7f4f86aeb000-7f4f86af0000 r-xp 00000000 08:03 4065985 /usr/lib64/gtk-2.0/modules/libcanberra-gtk-module.so
    44. 7f4f86af0000-7f4f86cf0000 ---p 00005000 08:03 4065985 /usr/lib64/gtk-2.0/modules/libcanberra-gtk-module.so
    45. 7f4f86cf0000-7f4f86cf1000 rw-p 00005000 08:03 4065985 /usr/lib64/gtk-2.0/modules/libcanberra-gtk-module.so
    46. 7f4f86cf1000-7f4f86d13000 r-xp 00000000 08:03 3952264 /usr/lib64/libdbus-glib-1.so.2.1.0
    47. 7f4f86d13000-7f4f86f12000 ---p 00022000 08:03 3952264 /usr/lib64/libdbus-glib-1.so.2.1.0
    48. 7f4f86f12000-7f4f86f14000 rw-p 00021000 08:03 3952264 /usr/lib64/libdbus-glib-1.so.2.1.0
    49. 7f4f905b6000-7f4f905b8000 rw-p 0021d000 08:03 1457483 /opt/Qt/5.3/gcc_64/lib/libicui18n.so.52.1
    50. 7f4f905b8000-7f4f905bc000 rw-p 00000000 00:00 0
    51. 7f4f905bc000-7f4f905bd000 r--s 00000000 08:03 2363930 /var/cache/fontconfig/ac68f755438cc3dc5a526084839fc7ca-le64.cache-3
    52. 7f4f905bd000-7f4f905cf000 r--s 00000000 08:03 2361223 /var/cache/fontconfig/74717c444f6fd72454fa9c9c0ee01ca7-le64.cache-3
    53. 7f4f905cf000-7f4f905d6000 r--s 00000000 08:03 2360868 /var/cache/fontconfig/928306c3ad40271d946e41014a49fc28-le64.cache-3
    54. 7f4f905d6000-7f4f905d7000 r--s 00000000 08:03 2363928 /var/cache/fontconfig/1248881498ac025e45c3042f6afe9284-le64.cache-3
    55. 7f4f905d7000-7f4f905da000 r--s 00000000 08:03 2363905 /var/cache/fontconfig/beeeeb3dfe132a8a0633a017c99ce0c0-le64.cache-3
    56. 7f4f905da000-7f4f90aea000 r-xp 00000000 08:03 1458026 /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5.3.2
    57. 7f4f90aea000-7f4f90ce9000 ---p 00510000 08:03 1458026 /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5.3.2
    58. .....................
    59. 7f4f90ce9000-7f4f90cf3000 r--p 0050f000 08:03 1458026 /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5.3.2
    60. 7f4f90cf3000-7f4f90d0c000 rw-p 00519000 08:03 1458026 /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5.3.2
    61. 7f4f90d0c000-7f4f90d0e000 rw-p 00000000 00:00 0
    62. 7f4f90d0e000-7f4f91209000 r-xp 00000000 08:03 1458031 /opt/Qt/5.3/gcc_64/lib/libQt5Gui.so.5.3.2
    63. 7f4f91209000-7f4f91409000 ---p 004fb000 08:03 1458031 /opt/Qt/5.3/gcc_64/lib/libQt5Gui.so.5.3.2
    64. 7f4f91409000-7f4f9141f000 r--p 004fb000 08:03 1458031 /opt/Qt/5.3/gcc_64/lib/libQt5Gui.so.5.3.2
    65. 7f4f9141f000-7f4f91431000 rw-p 00511000 08:03 1458031 /opt/Qt/5.3/gcc_64/lib/libQt5Gui.so.5.3.2
    66. 7f4f91431000-7f4f91434000 rw-p 00000000 00:00 0
    67. 7f4f91434000-7f4f91a2b000 r-xp 00000000 08:03 1458050 /opt/Qt/5.3/gcc_64/lib/libQt5Widgets.so.5.3.2
    68. 7f4f91a2b000-7f4f91c2b000 ---p 005f7000 08:03 1458050 /opt/Qt/5.3/gcc_64/lib/libQt5Widgets.so.5.3.2
    69. 7f4f91c2b000-7f4f91c55000 r--p 005f7000 08:03 1458050 /opt/Qt/5.3/gcc_64/lib/libQt5Widgets.so.5.3.2
    70. 7f4f91c55000-7f4f91c76000 rw-p 00621000 08:03 1458050 /opt/Qt/5.3/gcc_64/lib/libQt5Widgets.so.5.3.2
    71. 7f4f91c76000-7f4f91c78000 rw-p 00000000 00:00 0
    72. 7fffeb163000-7fffeb178000 rw-p 00000000 00:00 0 [stack]
    73. 7fffeb1ff000-7fffeb200000 r-xp 00000000 00:00 0 [vdso]
    74. ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
    75. The program has unexpectedly finished.
    76. /opt/project/qt/build-sdiapp-Desktop_Qt_5_3_GCC_64bit-Debug/sdiapp crashed
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,249
    Thanks
    36
    Thanked 1,508 Times in 1,459 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qt program unexpectedly finished.

    How do you create your main window object?

    Could you run into a double delete/free?

    Cheers,
    _

Similar Threads

  1. QUpdSocket The program has unexpectedly finished.
    By ariad in forum Qt Programming
    Replies: 8
    Last Post: 18th September 2014, 17:06
  2. The program has unexpectedly finished.
    By smemamian in forum Newbie
    Replies: 4
    Last Post: 1st April 2013, 00:44
  3. the program has unexpectedly finished
    By narlapavan in forum Qt Programming
    Replies: 9
    Last Post: 9th July 2012, 09:04
  4. Replies: 6
    Last Post: 24th June 2012, 18:32
  5. Program has unexpectedly finished
    By Maluko_Da_Tola in forum Newbie
    Replies: 5
    Last Post: 1st December 2010, 09:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.