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

QtCore: access violation is triggered in statically linked Qt originating from a static instance of QtMsgHandler in qglobal.cpp

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.7.2
    • Core: I/O, Core: Threads
    • None
    • Windows / Visual Studio 2008 / 2010 / 2005

    Description

      The code snippet below is enough to reproduce this, when built with a static build of Qt.

      #include <QDebug>
      
      struct MyStruct
      {
      	~MyStruct()
      	{
      		qWarning("Warning from destructor");
      	}
      }mystruct;
      
      
      
      
      int main(int argc, char *argv[])
      {
      	qDebug("Here in main()");
      	
      	return 0;
      }

      Since the static QtMsgHandler handler variable's destructor has already been called as a result of mystruct going out of scope or qDebug() being called an exception is thrown as there is no guarantee about the order in which this happens.

      If a shared version of Qt is used, the static variable QtMsgHandler handler stays valid as the static variables are not destroyed as soon as an object that is using them goes out of scope.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            cattell Matthew Cattell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes