Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileDialog The program has unexpectedly finished.
QtWS25 Last Chance

QFileDialog The program has unexpectedly finished.

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 8 Posters 8.0k Views
  • 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.
  • L Offline
    L Offline
    Linux BABU
    wrote on last edited by
    #1

    Hi,
    i have programing QFileDialog, when i press button i want to open the file dialog, when i run my program i got following messages,

    (imagecapture:14396): Gtk-WARNING **: Invalid input string

    (imagecapture:14396): Gtk-WARNING **: Invalid input string
    The program has unexpectedly finished.

    here i paste my code

    void MainWindow::on_sendto_clicked()
    {
    QString file_neme = QFileDialog::getExistingDirectory(this,tr("Open Directory"),"/home/malar/Documents/",QFileDialog::ShowDirsOnly|QFileDialog::DontUseNativeDialog);
    }

    i am using qt 5.8 and ubuntu 14.04 64bit, could you help me to solve this message.

    thanking you,

    1 Reply Last reply
    0
    • m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      Hi,
      there is nothing wrong with the code you posted (I've just tested it and it worked). The problem has to be somewhere in the environment in which you start your application.
      -Michael.

      1 Reply Last reply
      2
      • E Offline
        E Offline
        eti_nne
        wrote on last edited by eti_nne
        #3

        Hi,
        I encoutered a very similair issues and haven't been able to explain it.
        I "solved" it using the non static QFileDialog
        Dialog open method :

        it would be something like this :

        void MainWindow::on_sendto_clicked(void)
        {
        	QFileDialog *dialog = new QFileDialog;
        	dialog->setDirectory("/home/malar/Documents/");
        	dialog->setFileMode(QFileDialog::DirectoryOnly);
        	dialog->setOptions(QFileDialog::DontUseSheet
        					   | QFileDialog::DontUseCustomDirectoryIcons
        					   | QFileDialog::ReadOnly
        					   | QFileDialog::HideNameFilterDetails);
        	dialog->open(this, SLOT(on_sendto_clicked(const QString&)));
        }
        
        void MainWindow::on_sendto_clicked(const QString& file_neme )
        {
           // your process
        }
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          @eti_nne, you have a memory leak here. Your QFileDialog instance is never deleted.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          E 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            @eti_nne, you have a memory leak here. Your QFileDialog instance is never deleted.

            E Offline
            E Offline
            eti_nne
            wrote on last edited by
            #5

            @SGaist
            Indeed. My bad. I forgot a line :

            dialog->setAttribute(Qt::WA_DeleteOnClose);
            

            Copy pasting is definitely an art :)

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Linux BABU
              wrote on last edited by
              #6

              Hi all,

              Thanks for your replay ,

              It is working fine for me, but i have added don't use native dialog see here i attached that line,

              dialog->setOptions(QFileDialog::DontUseSheet
              | QFileDialog::DontUseCustomDirectoryIcons
              | QFileDialog::ReadOnly
              | QFileDialog::HideNameFilterDetails
              | QFileDialog::DontUseNativeDialog);

              Again i got same problem "The program has unexpectedly finished."

              Thanking You,

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Can you show a stack trace of your crash ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  Linux BABU
                  wrote on last edited by
                  #8

                  Hi,

                  i am new to qt where i can find this stack trace on qt creator.

                  thank you

                  FlotisableF 1 Reply Last reply
                  0
                  • L Linux BABU

                    Hi,

                    i am new to qt where i can find this stack trace on qt creator.

                    thank you

                    FlotisableF Offline
                    FlotisableF Offline
                    Flotisable
                    wrote on last edited by Flotisable
                    #9

                    @Linux-BABU
                    if you are using qtcreator, just press F5 to run the program in debug mode, when your program crash, it will show the stack trace on the bottom

                    1 Reply Last reply
                    1
                    • L Offline
                      L Offline
                      Linux BABU
                      wrote on last edited by
                      #10

                      Hi

                      This is my stack trace

                      1 ?? 0x7fffe0320526
                      2 ?? 0x7fffe032762e
                      3 ?? 0x7fffdb8448db
                      4 ?? 0x7fffdb8448f9
                      5 g_main_context_dispatch 0x7ffff1615ce5
                      6 ?? 0x7ffff1616048
                      7 g_main_context_iteration 0x7ffff16160ec
                      8 QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) 0x7ffff47f4cbf
                      9 QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) 0x7ffff47a29ca
                      10 QCoreApplication::exec() 0x7ffff47aa9f4
                      11 main main.cpp 10 0x40e488

                      Thank you

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Which Linux distribution are you on ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        L 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Which Linux distribution are you on ?

                          L Offline
                          L Offline
                          Linux BABU
                          wrote on last edited by
                          #12

                          @SGaist

                          ubuntu 14.04 64bit

                          1 Reply Last reply
                          0
                          • kd_walaK Offline
                            kd_walaK Offline
                            kd_wala
                            wrote on last edited by
                            #13

                            Hi, I using qml FileDialog on Ubuntu 16.04, Qt 5.8 ,it have same problem with message 'Gtk-WARNING **: Invalid input string' then may app is not respond, any one can help me fix this .

                            jsulmJ 1 Reply Last reply
                            0
                            • kd_walaK kd_wala

                              Hi, I using qml FileDialog on Ubuntu 16.04, Qt 5.8 ,it have same problem with message 'Gtk-WARNING **: Invalid input string' then may app is not respond, any one can help me fix this .

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @kd_wala Most probably nobody will be able to help if you do not show your code.
                              My guess is that this GTK warning isn't the actual problem.

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • C Offline
                                C Offline
                                calc84maniac
                                wrote on last edited by
                                #15

                                I'm getting the exact same error. I'm using Qt 5.8 on Debian 8 with GNOME 3.14.1. It crashes no matter what kind of file or directory dialog I open, if I pass the DontUseNativeDialog option flag. (I would be fine with native dialog, but it seemed the ShowDirsOnly flag was being ignored, so I tried using the Qt dialogs and here we are.)

                                Here is a detailed stack trace from the point where a static dialog method is called:

                                #0  0x00007fffecf75c16 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
                                No symbol table info available.
                                #1  0x00007fffecf7a56a in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
                                No symbol table info available.
                                #2  0x00007fffec60b4bb in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
                                No symbol table info available.
                                #3  0x00007fffec60b4d9 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
                                No symbol table info available.
                                #4  0x00007ffff2949b6d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
                                No symbol table info available.
                                #5  0x00007ffff2949f48 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
                                No symbol table info available.
                                #6  0x00007ffff2949ffc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
                                No symbol table info available.
                                #7  0x00007ffff69b3cbf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Core.so.5
                                No symbol table info available.
                                #8  0x00007ffff69619ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Core.so.5
                                No symbol table info available.
                                #9  0x00007ffff78d5a07 in QDialog::exec() () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Widgets.so.5
                                No symbol table info available.
                                #10 0x00007ffff78e6ecd in QFileDialog::getSaveFileUrl(QWidget*, QString const&, QUrl const&, QString const&, QString*, QFlags<QFileDialog::Option>, QStringList const&) () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Widgets.so.5
                                No symbol table info available.
                                #11 0x00007ffff78e6f8a in QFileDialog::getSaveFileName(QWidget*, QString const&, QString const&, QString const&, QString*, QFlags<QFileDialog::Option>) () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Widgets.so.5
                                No symbol table info available.
                                
                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  Hi @calc84maniac please install the debug symbol packages of these libraries, it will allow to get a better stack trace.

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  C 1 Reply Last reply
                                  0
                                  • SGaistS SGaist

                                    Hi @calc84maniac please install the debug symbol packages of these libraries, it will allow to get a better stack trace.

                                    C Offline
                                    C Offline
                                    calc84maniac
                                    wrote on last edited by
                                    #17

                                    @SGaist Sure. If you need me to get Qt 5.8.0 symbols too, please point me in the right direction since there don't seem to be any packages readily available.

                                    #0  update_current_folder_get_info_cb (cancellable=0xaedc40, info=0x0, error=0xa7aca0, user_data=0x9df380) at /tmp/buildd/gtk+3.0-3.14.5/./gtk/gtkfilechooserwidget.c:4268
                                            cancelled = 1
                                            data = 0x9df380
                                            impl = 0xa1c3b0
                                            priv = 0x0
                                    #1  0x00007fffecf7a56a in query_info_callback (source_object=<optimized out>, result=<optimized out>, user_data=0xaeee20) at /tmp/buildd/gtk+3.0-3.14.5/./gtk/gtkfilesystem.c:419
                                            async_data = 0xaeee20
                                            error = 0xa7aca0
                                            file_info = 0x0
                                            file = <optimized out>
                                    #2  0x00007fffec60b4bb in g_task_return_now (task=0xaeb390) at /build/glib2.0-y6934K/glib2.0-2.42.1/./gio/gtask.c:1077
                                    No locals.
                                    #3  0x00007fffec60b4d9 in complete_in_idle_cb (task=0xaeb390) at /build/glib2.0-y6934K/glib2.0-2.42.1/./gio/gtask.c:1086
                                    No locals.
                                    #4  0x00007ffff2949b6d in g_main_dispatch (context=0x7fffe8002450) at /build/glib2.0-y6934K/glib2.0-2.42.1/./glib/gmain.c:3111
                                            dispatch = 0x7ffff29466c0 <g_idle_dispatch>
                                            prev_source = 0x7b13e0
                                            was_in_call = 0
                                            user_data = 0xaeb390
                                            callback = 0x7fffec60b4d0 <complete_in_idle_cb>
                                            cb_funcs = <optimized out>
                                            cb_data = 0x7fffc0001190
                                            need_destroy = <optimized out>
                                            source = 0x7fffc0001120
                                            current = 0x6bae40
                                            i = 11
                                    #5  g_main_context_dispatch (context=context@entry=0x7fffe8002450) at /build/glib2.0-y6934K/glib2.0-2.42.1/./glib/gmain.c:3710
                                    No locals.
                                    #6  0x00007ffff2949f48 in g_main_context_iterate (context=context@entry=0x7fffe8002450, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /build/glib2.0-y6934K/glib2.0-2.42.1/./glib/gmain.c:3781
                                            max_priority = 0
                                            timeout = 0
                                            some_ready = 1
                                            nfds = <optimized out>
                                            allocated_nfds = 5
                                            fds = 0x97b980
                                    #7  0x00007ffff2949ffc in g_main_context_iteration (context=0x7fffe8002450, may_block=1) at /build/glib2.0-y6934K/glib2.0-2.42.1/./glib/gmain.c:3842
                                            retval = <optimized out>
                                    #8  0x00007ffff69b3cbf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Core.so.5
                                    No symbol table info available.
                                    #9  0x00007ffff69619ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Core.so.5
                                    No symbol table info available.
                                    #10 0x00007ffff78d5a07 in QDialog::exec() () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Widgets.so.5
                                    No symbol table info available.
                                    #11 0x00007ffff78e6d5f in QFileDialog::getSaveFileUrl(QWidget*, QString const&, QUrl const&, QString const&, QString*, QFlags<QFileDialog::Option>, QStringList const&) () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Widgets.so.5
                                    No symbol table info available.
                                    #12 0x00007ffff78e6f8a in QFileDialog::getSaveFileName(QWidget*, QString const&, QString const&, QString const&, QString*, QFlags<QFileDialog::Option>) () from /home/user/Qt5.8.0/5.8/gcc_64/lib/libQt5Widgets.so.5
                                    No symbol table info available.
                                    
                                    1 Reply Last reply
                                    0
                                    • C Offline
                                      C Offline
                                      calc84maniac
                                      wrote on last edited by
                                      #18

                                      I did a little research on my own, and it looks like this is a reference counting bug in GTK+, which was fixed in GTK+ 3.15.5. The bug tracker entry is here: https://bugzilla.gnome.org/show_bug.cgi?id=725164

                                      It appears that Firefox had to put in a workaround for this very issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1166741

                                      I'm not sure if it's worth putting a workaround in Qt or not, but it would be nice to not have segfaults.

                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #19

                                        Since you could gather some additional hints, I'd say it would be worth double checking the bug report system to check if it's something known, if so add your findings otherwise open a new report with what you already found.

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved