Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Using QSettings on Mac crashes on launch. Is there a fix?
Forum Update on Monday, May 27th 2025

Using QSettings on Mac crashes on launch. Is there a fix?

Scheduled Pinned Locked Moved Solved Installation and Deployment
qsettingsmaccrash
16 Posts 3 Posters 5.6k 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.
  • S SGaist
    12 Jan 2016, 20:59

    You don't need a global QSettings. Just create one when you need to either read or write a setting and be done with it.

    C Offline
    C Offline
    Crossy
    wrote on 12 Jan 2016, 21:33 last edited by
    #7

    @SGaist Thanks. I assume this means that the bug report was not related to my problem? Thanks for your help!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 12 Jan 2016, 21:36 last edited by
      #8

      The bug report was about a corrupted file which doesn't match your use case.

      All in all, since you have already built Qt with the patch applied, did you also test it for your use case ?

      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 12 Jan 2016, 22:05
      0
      • S SGaist
        12 Jan 2016, 21:36

        The bug report was about a corrupted file which doesn't match your use case.

        All in all, since you have already built Qt with the patch applied, did you also test it for your use case ?

        C Offline
        C Offline
        Crossy
        wrote on 12 Jan 2016, 22:05 last edited by
        #9

        @SGaist Qt with the patch applied is still building ;( I tested the above with the original build I was using when I got the error and the program loaded with no problems. Thanks again for your help :)

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 12 Jan 2016, 22:16 last edited by
          #10

          Still building ? What machine do you have ? What options did you pass to configure ?

          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 12 Jan 2016, 22:38
          0
          • S SGaist
            12 Jan 2016, 22:16

            Still building ? What machine do you have ? What options did you pass to configure ?

            C Offline
            C Offline
            Crossy
            wrote on 12 Jan 2016, 22:38 last edited by Crossy 1 Dec 2016, 22:39
            #11

            @SGaist A 2011 Mac book pro. The reason it's still building because it failed about an hour in while I was out. So I'm building it again :)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 12 Jan 2016, 22:39 last edited by
              #12

              If you only need the core modules for your application, just build qtbase, that will save you lots of times

              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 12 Jan 2016, 22:46
              0
              • S SGaist
                12 Jan 2016, 22:39

                If you only need the core modules for your application, just build qtbase, that will save you lots of times

                C Offline
                C Offline
                Crossy
                wrote on 12 Jan 2016, 22:46 last edited by
                #13

                @SGaist Thanks - not sure if i did that or not, lol, but I'll do it next time as I'm only using the core modules :)

                1 Reply Last reply
                0
                • S SGaist
                  12 Jan 2016, 20:59

                  You don't need a global QSettings. Just create one when you need to either read or write a setting and be done with it.

                  S Offline
                  S Offline
                  sandy.martel23
                  wrote on 12 Jan 2016, 22:51 last edited by
                  #14

                  @Crossy said:

                  QSettings settings;

                  void GlobalSettings::saveSetting(int day) // This function is defined statically in globalsettings.h.
                  {
                  settings.setValue("dayNumber", day);
                  }

                  SGaist is right, the code should look like this:

                  void GlobalSettings::saveSetting(int day) // This function is defined statically in globalsettings.h.
                  {
                  QSettings settings; // <-- NOT a global
                  settings.setValue("dayNumber", day);
                  }

                  This is much better than your current implementation, since the destructor of QSettings will save/sync the preferences right away.
                  And if the global is really what is causing the problem, that would fix it.

                  C 1 Reply Last reply 12 Jan 2016, 22:56
                  0
                  • S sandy.martel23
                    12 Jan 2016, 22:51

                    @Crossy said:

                    QSettings settings;

                    void GlobalSettings::saveSetting(int day) // This function is defined statically in globalsettings.h.
                    {
                    settings.setValue("dayNumber", day);
                    }

                    SGaist is right, the code should look like this:

                    void GlobalSettings::saveSetting(int day) // This function is defined statically in globalsettings.h.
                    {
                    QSettings settings; // <-- NOT a global
                    settings.setValue("dayNumber", day);
                    }

                    This is much better than your current implementation, since the destructor of QSettings will save/sync the preferences right away.
                    And if the global is really what is causing the problem, that would fix it.

                    C Offline
                    C Offline
                    Crossy
                    wrote on 12 Jan 2016, 22:56 last edited by
                    #15

                    @sandy.martel23 Thanks for your help :) It was the global causing the problem - after changing it to how you and SGaist suggested, it has worked :) Thank you!

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 12 Jan 2016, 23:17 last edited by
                      #16

                      Good !

                      Since everything is working now, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been 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

                      16/16

                      12 Jan 2016, 23:17

                      • Login

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