Hi,
I have fairly simple question.
In a lot of cases people use a template/ function or macro to 'Safely release' COM objects.
For example:
#define SafeRelease(x) if(x){x->Release(); x=NULL;}
But what if we have this situation:
LPD3DXEFFECT mEffect = NULL;
D3DXCreateEffectFromFileA(pD3ddev, mFilename.c_str(), NULL, NULL, 0, pEffectPool, &mEffect, &errorBuffer));
And the effect is not created for some reason, i.e. filename doesn't exist.
Then in the destructor of the class 'mEffect' is part of I call:
SafeRelease(mEffect);
But this causes a crash and when I don't release the mEffect there's no memory leak. But I just want to keep clean/ nicely released objects.
How would I do that?