简体   繁体   中英

Random error in exe_common.inl in Debug build

I am using VS 2022 Community Edition (v17.3.3) to build wxWidgets application (v3.2.0) using C++ (v14.3 - Features from Latest C++). The windows SDK is using the latest installed (10.0.22621). The project is also using C++ modules.

The Debug build succeeds but when I run the project's exe file at random it throws the exception ( Access violation reading 0xFFFFFF (ucrtbased.dll) ) in exe_common.inl at the following line:

__scrt_current_native_startup_state = __scrt_native_startup_state::initialized;

After a few more compilations (by just making minor changes to trigger a compilation) it succeeds and the exe runs correctly.

I wonder if there is any settings that might be causing this random error. Btw, I am using Win11 but same thing happens on Win10 as well.

Thanks in advance.

EDIT 1:

The project is using boost libraries and at startup boost/json (boost/json is used in other parts of the project as well). Debugger shows that after the following line the above error happens:

static allocator_arg_t allocator_arg = BOOST_CONTAINER_DOC1ST(unspecified, *std_allocator_arg_holder<>::dummy);

There were a few things needed attention:

  1. Discontinued use of wxSQLite (the library was not maintained for over a decade),
  2. The main frame was a singleton data structure, not anymore, and not deriving from wxMDIFrame anymore.
  3. All unnecessary (a chain of them) #include removed.
  4. Inclusion of <boost/json.hpp> in a few files were removed and now using #include <boost/json/src.hpp> only in one.cpp file. However, the project still uses inclusion of <boost/json/value.hpp> in multiple.h files.
  5. All uninitialized pointer variables and others were initialized.

#1 and #4 were especially pointed by the debugger. It has now been more than a few days and haven't had the problem since then.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM