Jump to content

  • Log In with Google      Sign In   
  • Create Account

Do Direct3D objects automatically have Release called from their destructor?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 mrheisenberg   Members   -  Reputation: 356

Like
0Likes
Like

Posted 15 March 2013 - 05:29 PM

I am saying this, because I use a wrapper class that in its destructor deletes its content and I'm using it for many kinds of objects, some of them have release methods(like d3d buffers) and some of them don't, so I was wondering if it's sufficient to only call delete on the pointer.I couldn't find any info on this in MSDN, but I'm almost sure they did some safety measure like that, I mean why wouldn't they?



Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 8285

Like
1Likes
Like

Posted 15 March 2013 - 05:44 PM

D3D objects don't have destructors - they're not C++ objects as you understand them, but COM objects instead.  If you look at the D3D header files you'll see that they're declared as neither classes nor structs, and you'll know from your own code that they're not instantiated via "new" but rather returned as a pointer from a Create call.

 

So you must manually Release them all yourself.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 Jason Z   Crossbones+   -  Reputation: 5428

Like
2Likes
Like

Posted 15 March 2013 - 05:48 PM

And of course, you should only release it once for each proper acquisition of the object that you have performed.  If you do it too many times (accessing illegal memory area) or too few (memory leak) times, then you will get some issues.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS