Problem with CallbackNode and transparency

Hi,

I have a problem with callback node.
Here is sample code.
.h

#include <callbackObject.h>

class MyCallback : public CallbackObject
{
public:
	ALLOC_DELETED_CHAIN( MyCallback );
	virtual void do_callback( CallbackData* pCbData );
};

.cpp

// includes...
PandaFramework framework;

void MyCallback::do_callback( CallbackData* pCbData )
{
	float fS = 3.0f;

	glEnable( GL_BLEND );
	glBegin( GL_TRIANGLES );
		glColor4f( 1.0f, 0.6f, 0.3f, 0.5f );

		glVertex3f( -fS, fS, -fS );
		glVertex3f( fS, fS, -fS );
		glVertex3f( fS, fS, fS );

	glEnd();
	pCbData->upcall();
}

int _tmain( int argc, char* argv[] )
{
	framework.open_framework( argc, argv );
	framework.set_window_title( "Title of the below window" );

	WindowFramework* window = framework.open_window();
	window->setup_trackball();

	PT( CallbackNode ) cbNode = new CallbackNode( "my new node" );
	cbNode->set_draw_callback( new MyCallback() );
	NodePath cbNp( cbNode );
	cbNp.reparent_to( window->get_render() );
	//cbNp.set_transparency( TransparencyAttrib::M_alpha ); // not working
	//cbNp.set_transparency( TransparencyAttrib::M_binary ); // is working

	framework.main_loop();
	framework.close_framework();

	return 0;
}

Now, the code is working and my triangle is visible. When I uncomment the line with M_alpha transparency mode I have unhandled exception. With M_binary it is working.
The same thing when I use CPointerCallbackObject (M_alpha causes exception, M_binary is ok). I tried under Python and it is working for both alpha and binary.
What is wrong? I’m using Panda 1.8.0 but tried 1.7.2 with no luck either. Platform is Windows.
What I am really trying to do is extension with new type of node which will draw my (hardcoded) OpenGL code. It crashes in MyNode::add_for_draw() function at

trav->get_cull_handler()->record_object( cullable, trav );

line. It is culling stage, right?

Second thing are the messages (VS hits breakpoint)

Heap block at 02EAD7A0 modified at 02EAD888 past requested size of e0
Invalid Address specified to RtlFreeHeap( 02D40000, 02EAD7A8 )

when I close application (when it works of course). It happens when I create PandaNode of any kind. When I eg. load model from .egg application closes normally. It also closes normally when I don’t use PT() but this:

CallbackNode* cbNode = new CallbackNode( "my new node" );
cbNode->ref();

But that is not the right way, is it?

The crash with M_alpha seems very strange; are you sure you are compiling your build with the correct project settings to match Panda’s build?

Avoiding the crash at exit might be a matter of ensuring you have freed the nodes you have created (by setting the pointers to NULL, or letting them go out of scope) before you call close_framework().

David