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

Crash on MSVC in ~QMetaTypeFunctionRegistry() on program end with dynamically loaded Qt

    XMLWordPrintable

    Details

    • Platform/s:
      Windows
    • Commits:
      fa7f4c5efd91c852341dd2e56396ee3f5fedd33a dbb2092d8d27eb3d5bb8a0f770b00fc93bb3553e

      Description

      I get a crash on MSVC with a program that loads Qt libraries dynamically when loading a shared library plugin (created via Boost.DLL). The crash comes at program end (very late), after most threads have already ended. It seems to come from somewhere inside Qt6Cored.dll, and have something to do with QMetaTypeFunctionRegistry. I do indeed use QMetaType with Q_DECLARE_METATYPE and qRegisterMetaType to register a number of custom types, like std::string and a few std::shared_ptr, so maybe this is related

      The compiler I use to build Qt is MSVC 2019, v19.10.1. The compiler I use for my other libraries and projects (on top of Qt) is ClangCl 12.0.0 from LLVM upstream, in combination with MSVC 2019, v19.10.1.

      The crash stops in the following line:

      _Getimpl()->_Delete_this(!_Local());
      

      Here is the stack trace as far as I could get it from Visual Studio:

       	Qt6Cored.dll!std::_Func_class<bool,void *,void *>::_Tidy() Line 1046	C++
       	Qt6Cored.dll!std::_Func_class<bool,void *,void *>::~_Func_class<bool,void *,void *>() Line 973	C++
       	Qt6Cored.dll!std::function<bool __cdecl(void *,void *)>::~function<bool __cdecl(void *,void *)>()	C++
       	Qt6Cored.dll!QHashPrivate::Node<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>::~Node<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>()	C++
       	Qt6Cored.dll!QHashPrivate::Node<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>::`scalar deleting destructor'(unsigned int)	C++
       	Qt6Cored.dll!QHashPrivate::Span<QHashPrivate::Node<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>>::freeData() Line 324	C++
       	Qt6Cored.dll!QHashPrivate::Span<QHashPrivate::Node<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>>::~Span<QHashPrivate::Node<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>>() Line 316	C++
       	[External Code]	
       	Qt6Cored.dll!QHashPrivate::Data<QHashPrivate::Node<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>>::~Data<QHashPrivate::Node<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>>() Line 690	C++
       	[External Code]	
       	Qt6Cored.dll!QHash<std::pair<int,int>,std::function<bool __cdecl(void *,void *)>>::clear() Line 859	C++
      >	Qt6Cored.dll!QMetaTypeFunctionRegistry<std::function<bool __cdecl(void *,void *)>,std::pair<int,int>>::~QMetaTypeFunctionRegistry<std::function<bool __cdecl(void *,void *)>,std::pair<int,int>>() Line 1535	C++
       	[External Code]	
      

        Attachments

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

          Activity

            People

            Assignee:
            mmutz Marc Mutz
            Reporter:
            emmenlau Mario Emmenlauer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: