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. [SOLVED] SIGSEGV 11 - on close from the taskbar but not from the mainwindow (x) cloase button
Qt 6.11 is out! See what's new in the release blog

[SOLVED] SIGSEGV 11 - on close from the taskbar but not from the mainwindow (x) cloase button

Scheduled Pinned Locked Moved General and Desktop
15 Posts 2 Posters 5.9k Views 1 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #5

    Did you try to run it in a debugger ?

    You might be using something that has been already destroyed.

    Also you have a memory leak in your main. you never delete your app.

    On a side note Qt already proposes QtSingleApplication in its "Solution" catalog.

    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
    • A Offline
      A Offline
      arsinte_andrei
      wrote on last edited by
      #6

      bq. On a side note Qt already proposes QtSingleApplication in its “Solution” catalog.

      yes is true I've found it "here":http://doc.qt.digia.com/solutions/4/qtsingleapplication/qtsingleapplication.html
      but not in Qt 5.3 so I can not do like #include <QSingleApplication> and because of that I will use mine one.. witch is not perfect but tried to copy some info from there...

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

        The solutions are not part of either Qt 4 or 5 you have to download them and integrate them in your project

        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
        • A Offline
          A Offline
          arsinte_andrei
          wrote on last edited by
          #8

          ahammm.. thanks.. I'll try this... never knew about this any way about memory leak as far as i remember I've read somewere that Qt will manage this and close everithing for me... can you bring a good example of how I should close it not to have that memory leak? it is possible to receive because of that SIGSEGV?

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

            Qt does indeed help with memory management through e.g QObject parent/child handling but it doesn't replace everything.

            @
            int main(int argc, char *argv[]){
            //snip
            AtpSingleApplication *app = new AtpSingleApplication(appId, argc, argv); << allocating the application on the heap
            app->setOrganizationName("atp");
            app->setOrganizationDomain("atp-trading.com");
            app->setApplicationName("@atp@");
            app->setApplicationVersion("1");
            app->setApplicationDisplayName("atp");
            //snip again
            AtpMainWindow win;
            win.show();
            return app->exec(); << you don't delete the application, Qt can't do it for you.
            }
            @

            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
            • A Offline
              A Offline
              arsinte_andrei
              wrote on last edited by
              #10

              by the way I've run the program in windows and bealiveme no SIGSEGV. usualy in windows there is a message box but everithing was fine.. wat is mre anoing is why is troing out SIGSEGV if the return is 0 - app finish corectly hm... have to do more reasearch - only on linux enviroment

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

                Memory management is not the same in both OS. Did you run it using a debugger ? What happens if you delete the app object by hand ?

                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
                • A Offline
                  A Offline
                  arsinte_andrei
                  wrote on last edited by
                  #12
                  • main.cpp
                    @//main run
                    int ret = app->exec();
                    qDebug()<< "Del app"; //just to monitor the behaviour
                    delete app;
                    qDebug()<< "Del app after"; //just to monitor the behaviour
                    return ret;
                    @
                    this is perfect under linux exit with 0 end no signal caught;
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13

                    Are you can just create app on the stack

                    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
                    • A Offline
                      A Offline
                      arsinte_andrei
                      wrote on last edited by
                      #14

                      sorry but i do not understand what do you want to say.
                      bq. Are you can just create app on the stack
                      what that means?? Sorry but englisn is not my native language

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

                        Search for "stack vs heap"

                        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