Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82913

QDatetime crash when main exited

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P2: Important
    • None
    • 5.7.0
    • Core: Date/Time
    • None
    • Linux/Wayland

    Description

      The following example will crash .I want to know why.
      Environment:

      $ cat /etc/redhat-release 
      CentOS Linux release 7.6.1810 (Core) 
      $ uname -a 
      Linux localhost.localdomain 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 
      $ qmake -v 
      QMake version 3.0 
      Using Qt version 5.7.0 in /opt/Qt5.7.0/5.7/gcc_64/lib
      

      code:

      #include <QDateTime>
      
      class P{
      public:
          P(){}
          ~P(){
              now();
          }
          static inline void now()
         {
              QDateTime();
          }
      };
      
      int main(int argc, char *argv[])
      {
           printf("start main\n");
           static P p;
           p.now();
           printf("main exit\n");
           return 0;
      }
      

      The screenshot above is based on Qt5.7.0. I haven't crashed since I updated to Qt5.14.0, but QDateTime().currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") returned an empty string;

      Attachments

        1. 1.png
          1.png
          124 kB
        2. 2.png
          2.png
          233 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Eddy Edward Welbourne
            jinbq junhua0718
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes