D3DDevice-Present(...) makes app crash

Started by
16 comments, last by Leoric 19 years, 7 months ago
Hey guys,

I fixed the memory leak. It was an LPDIRECT3DINDEXBUFFER9 not being released from a class destructor. You're right, MMGR didn't see it.

I tried some tutorials over at www.codesampler.com
App crashes on exit with debug breakpoint in ntdll.dll :-(
Maybe the guys @ Codesampler are as lazy as me *laugh*

The render function isn't called after the window is destroyed. Only if Render() returns false or I hit ESC, the main loop ends. And because the window is the first thing my app creates, it is the last thing my app destroys. So the D3DDevice is released before the window is destroyed. I also did
if( IsWindow( hWnd ) ) Render();
else break;
in my main loop. No errors.

By the way: The Gunmetal benchmark crashes 3 out of 5 times when running with the dx debug runtimes at max level. I also had a 3DMark03 crash now and then.

I will now reinstall my DX9.0c SDK and also reinstall Catalyst 4.3 and see what happens.

Bye for now,
Leoric
Advertisement
Don't reinstall 4.3. Download & install 4.9. [grin]
I recently bought a R9800Pro and went from 4.3 to 4.9 - since then, madness reigns on my system.

I did some benchmarks to compare the 4.3 & 4.9 performance. 4.3 is faster in some benchmarks. Especially ShaderMark, which sees the 4.3 ahead around 50 fps in some tests.

Bye,
Leoric

Quote:Original post by Leoric
(snip)

The app runs fine and everything is rendered as it should. But after closing the app, the error message "invalid pipe state" ( WinErrCode 230 ) appears and the debugger kicks in telling me there was some trouble with "GetClientRect" and "BitBlt" and stops at the debug breakpoint in NTDLL.DLL

(snip)

The function leading to the crash is:
D3DDevice->Present( NULL, NULL, hWnd, NULL );
Before, someone told me it could be an invalid window handle but I tested a lot and I am pretty sure the handle is valid.

(snip)


It still appears that Present is being called after the window is closed.
I wonder how this should happen ? These are the last lines of code:

while( !g_bEndApp ) { HandleMessages();   if( FAILED( RenderScene()) )    break; }ReleaseCOM();ReleaseWindow();exit( 1 );


As you can see, Present() is only called inside the RenderScene()-function. The window is destroyed outside the mainloop. In addition, the DX-Objects are released before the window is destroyed. I destroy any objects in reverse order of creation.

Bye,
Leoric
The WM_CLOSE/WM_DESTROY messages will be picked up and processed inside HandleMessages(). By the time HandleMessages() returns from handling a WM_DESTROY, the window handle is no longer valid.
Quote:Original post by Anonymous Poster
The WM_CLOSE/WM_DESTROY messages will be picked up and processed inside HandleMessages(). By the time HandleMessages() returns from handling a WM_DESTROY, the window handle is no longer valid.


Oops. That was me.
But what part of my code is supposed to post the WM_QUIT / WM_CLOSE message. Hitting the ESC-key makes g_bEndApp = true.
When g_bEndApp is true, the HWND is still valid, isn't it ? No rendering will happen after g_bEndApp has gone true. So, next thing is to delete any DX-objects. After deleting the D3D-devices, the window is still valid.

See ya,
Leoric

This topic is closed to new replies.

Advertisement