Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Do i need to release COM objects if they are NULL

$
0
0
Do i need to release COM objects in Directx11 if they are set to NULL?

For example in my code i have
//Variables initialization
ID3D11Device* d3d11Device = NULL;

//in my shutdown function
if(d3d11Device!=NULL){d3d11Device->Release();} 



Lets say an error occurs so my program calls my shutdown function and d3d11Device never get set a new value should it still be released?, because when i dont have the cleanup set up like that i get access violation which i presume are from d3d11Device being NULL

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>