Crash at Standard_Transient::EndScope() when testing Handles

Hello Folks,

I read Romans Blog about Handles and I implemented a simple Hello World program. Unfortunately my program crashes when the destructor is called. Can somebody tell me, what's wrong in the code below?

// ////////////////// CODE ///////////////////////////
using namespace std;
#include
#include

#include
#include
#include

DEFINE_STANDARD_HANDLE(HandleTest, Standard_Transient)

class HandleTest{
public:
HandleTest(){} // empty ctor
void PrintHelloWorld() { cout

public:
DEFINE_STANDARD_RTTI(HandleTest)

};

IMPLEMENT_STANDARD_HANDLE(HandleTest, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(HandleTest, Standard_Transient)

int main(int argc, char* argv[])
{
if(true)
{
Handle(HandleTest) aTest = new HandleTest;
aTest->PrintHelloWorld();
cout }
cout

return(0);
}

// ///////////////// COMPILE //////////////////
g++ -o handleTest main.cxx -I/.../OCC/ros/inc -I. -L/.../OCC/ros/lin/lib -lTKernel -ldl -DHAVE_CONFIG -DHAVE_LIMITS -DHAVE_IOSTREAM -O0

// ///////////////// OUTPUT ////////////////////
Hello World
Before DTOR
Segmentation fault

Thanks in advance,

Dennis

Dennis G.'s picture

Okay!!!

I forgot to inherit my class from Standard_Transient.

Now it works...