[Boost-bugs] [Boost C++ Libraries] #11403: exception_ptr.hpp causes crash when .NET tries to unload a DLL that uses boost

Subject: [Boost-bugs] [Boost C++ Libraries] #11403: exception_ptr.hpp causes crash when .NET tries to unload a DLL that uses boost
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-15 08:19:24


#11403: exception_ptr.hpp causes crash when .NET tries to unload a DLL that uses
boost
------------------------------+----------------------------
 Reporter: onkelhotte@… | Owner: emildotchevski
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: exception
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------------
 Hello,
 I posted this on the gmane board and Emil Dotchevski said I should open a
 ticket for this.

 We are working with Visual Studio 2013 and have a plain c++ lib that uses
 boost. To test it, we wrote a (non clr) console program and a WPF GUI for
 further use.
 This WPF GUI contains a clr dll as a wrapper between the .NET world and
 the plain c++ libs.
 At startup, both console and WPF call some function pointers in _initterm
 in crt0dat.c, especially these two:
 [[BR]]
 dynamic initializer for
 'boost::exception_detail::exception_ptr_static_exception_object<boost::exception_detail::bad_alloc_>::e''(void)
 [[BR]]
 dynamic initializer for
 'boost::exception_detail::exception_ptr_static_exception_object<boost::exception_detail::bad_exception_>::e''(void)

 The console terminates cleanly. But the GUI causes an exception in
 crtdll.c, _CRT_INIT, line 414:

 /* call the function, which can eventually change __onexitbegin and
 __onexitend */
 [[BR]]
 (*function_to_call)();

 The debugger says the value of *function_to_call is
 [[BR]]
 *function_to_call
 _t2m@???__Fep@?1???$get_static_exception_object_at_Ubad_exception__at_exception_detail_at_boost@@@exception_detail_at_boost@@YA?AVexception_ptr_at_1@XZ_at_YAXXZ@?A0xd1be0c67@@YAXXZ

 and causes an unhandled exception at 0x74c7c42d (KernelBase.dll), The
 String binding is invalid.

 However, if I change (remove the static keyword) line 130 in
 exception_ptr.hpp from
 [[BR]]
 static exception_ptr ep(shared_ptr<exception_detail::clone_base const>(new
 exception_detail::clone_impl<Exception>(c)));

 to

 exception_ptr ep(shared_ptr<exception_detail::clone_base const>(new
 exception_detail::clone_impl<Exception>(c)));

 the GUI exits cleanly.

 Best regards,[[BR]]
 Markus Pieper

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11403>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC