Debug Assertion from javaw.exe
843829Oct 11 2003 — edited Jan 19 2005I'm getting a Debug Assertion Failed from javaw.exe: (Windows 2000)
jre1.4.2\bin\javaw.exe
File: dbgheap.c
Line 1044
Expression: _CrtIsValidHeapPointer(pUserData)
This occurs on one of my native DLL method calls. Here's the scenario:
I've got a set of supplied DLLs from a manufacturer that are implemented using C++ and STL. I'm working on a wrapper DLL that maps to a Java class in that my Java class invokes the appropriate native methods in my wrapper DLL, which in turn works with the supplied vendor DLL's.
As part of the initialization, I load up my wrapper DLL, and invoke its initialize() method, which in turn instantiates a C++ object:
DShowLib::Grabber* m_pGrabber;
JNIEXPORT void JNICALL Java_biz_femtosoft_rtfrog_data_framegrabber_ImagingSourceFWFrameGrabber_initialize
(JNIEnv *, jobject)
{
if( !DShowLib::InitLibrary( "********" ) )
{
fprintf( stderr, "The library could not be initialized ");
fprintf( stderr, "(invalid license key?).\n");
exit( 1 );
}
m_pGrabber = new DShowLib::Grabber();
fprintf( stdout, "[DEBUG] The library has been initialized \n");
}
Note that this C++ object is referenced by a global variable, m_pGrabber.
In a subsequent function in my wrapper DLL, I invoke a method on the instantiated C++ object, and that is where the debug assertion happens:
JNIEXPORT jobjectArray JNICALL Java_biz_femtosoft_rtfrog_data_framegrabber_ImagingSourceFWFrameGrabber_jni_1getVideoCaptureDevices
(JNIEnv *env, jobject)
{
fprintf( stdout, "[JNI FRAMEGRABBER] Entering getVideoCaptureDevices JNI function call\n");
if (m_pGrabber != 0) {
// Generate a list of all available video devices
DShowLib::Grabber::tVidCapDevListPtr pVidCapDevList = m_pGrabber->getAvailableVideoCaptureDevices();
}
}
I've omitted much of the source for brevity.
Can anyone tell me what I might be doing that's causing this? I'm pretty rusty on my C++ coding, so there's a good chance that I am forgetting something quite fundamental.
Regards,
Ron Cordell