Boost logo

Boost :

Subject: [boost] VS2005 SP1 Hard Debugger Crash in Class Destructor with Boost.Filesystem
From: Jack Yee (jyee999_at_[hidden])
Date: 2010-04-12 23:31:46


Hello,

I have a very strange crash involving the use of auto-linking of the
boost::filesystem (1.38/1.42) and putting breakpoints in a unmanaged
class destructor.  It crashes hard enough that the task must be
stopped through the Task Manager.  Below is the test case that causes
the crash:

#include "stdafx.h"
#include <vcclr.h>

#include "boost/filesystem.hpp" // Note 1

public ref class ClassOne
{
public:
  ClassOne() {}
  ~ClassOne() {}
};

class ClassTwo
{
public:
  ClassTwo(ClassOne^ p) {one = p;}
  ~ClassTwo() {one = nullptr;} // Note 2

  gcroot<ClassOne^> one;
};

int _tmain(int argc, _TCHAR* argv[])
{
    ClassOne ^one = gcnew ClassOne();
    ClassTwo *two = new ClassTwo(one);

    delete two; // Note 3

    return 0;
}

Note 1 -- Commenting out this header and setting breakpoint at Note 2 will be OK

Note 2 -- Putting a breakpoint here with "boost/filesystem.hpp" will
cause VS2005 to crash

Note 3 -- Putting a breakpoint here with "boost/filesystem.hpp" will be OK

BUILD CONFIGURATION:
  * Common Language Runtime Support (/clr) enable
  * Preprocessor defines: WIN32;_DEBUG;_CONSOLE;
  * Standard include and library search paths to your Boost installation.

Other Useful information:

  * Running the program without breakpoints doesn't indicate any
errors or non-zero exit codes.
  * Tried both 1.38 and 1.42 boost libraries
  * Debugger crash does not happen under VS2008
  * Same crash results on Windows XP Professional, Vista Business and
Windows 7 machines.

Event Viewer Output:

Faulting application devenv.exe 8.050727.867, time stamp 0x45d2c842,
faulting module OLEAUT32.dll, version 6.0.6001.18000, time stamp
0x4791a74f, exception code 0xc0000005, fault offset 0x00003e56,
process id 0x8ec, application start time 0x01cadab2a1430262.

Hopefully the example is concise enough that I can get some other
willing people to try it out and see if they get the same results.

Apologies in advance if there is a typo in the source code as the work
machines are isolated from connecting from the Internet.

Thanks!

Jack


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk