NuiInitialize bug RRS feed

  • Question

  • int i = 0;
    while(true) {
    	printf("Initialize: %d\n", i);
    	HRESULT hr = NuiInitialize( nuiFlags );
    	if ( FAILED( hr ) )
    		printf("NuiInitialize failed :(\n");
    	printf("Shut down\n");
    	NuiShutdown( );
    On my system (Win7 Ultimate x64, MSVC2010 Ultimate, 32-bit target), this consistently hangs on the second iteration of the loop, somewhere inside NuiInitialize. This happens when using INuiInterface too - doing this sequence of calls:
    NuiCreateSensorByIndex(0, &pSensor), pSensor->NuiInitialize(...), pSensor->NuiShutdown(...), pSensor->Release()
    will also hang on the second pSensor->NuiInitialize() call (note that pSensor->Status() before that will succeed, for example). As an interesting side-note, Release() returns 4, meaning that there's likely a COM reference leak inside the KinectSDK code (also, if I call release till it returns 0 and actually frees the object, I get a "pure virtual function called" assertion error (I assume that's the destructor)
    I did some experiments with dynamically loading/unloading the DLL too, and the behavior didn't really change, and some nastier ones where I forcefully closed some open resources left over between the first and second calls to NuiInitialize using process explorer, with the results not changing. I suspected it's some sort of internal race condition, so I messed around with adding Sleep()s to my code (The hallmark of good code...), and I reached a point where multiple init/shutdown pairs worked maybe once per 5 runs or so...
    I'm using version, and this seems to be the same problem as
    Friday, January 27, 2012 1:23 AM


All replies