Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


#ActualConny14156

Posted 18 February 2013 - 10:55 PM

Hi,

This may seems as a weird question but, is this the correct way to "Store" a ID3D11ShaderResourceView* Pointer?

Am trying to store COM Object pointer inside a simple map with a std::string key.

I get no error's but when I quit the program it complains about unreleased objects.

Neither do I get a error when I try to release the "objects".

So I start to question my method about how to release it.

The reason why I am using a while loop with .empty(); is cause I can't seems to use the [] operator except for [0]. while am at it would appreciate if someone could explain that to >.<

 

		
ID3D11ShaderResourceView* t;
std::map<std::string,ID3D11ShaderResourceView*> TotalTexture;
std::vector<std::string> TotalTextureToLoad;
TotalTexture.insert
(
TotalTexture.end(),std::pair<std::string,ID3D11ShaderResourceView*>(TotalTextureToLoad[i],t)

);
while(!TotalTexture.empty())
{
	TotalTexture.begin()->second->Release();
	TotalTexture.erase(TotalTexture.begin());
}

 

 

 

 

 

    

#1Conny14156

Posted 18 February 2013 - 02:28 AM

Hi,

This may seems as a weird question but, is this the correct way to "Store" a ID3D11ShaderResourceView* Pointer?

Am trying to store COM Object pointer inside a simple map with a std::string key.

I get no error's but when I quit the program it complains about unreleased objects.

Neither do I get a error when I try to release the "objects".

So I start to question my method about how to release it.

The reason why I am using a while loop with .empty(); is cause I can't seems to use the [] operator except for [0]. while am at it would appreciate if someone could explain that to >.<

 

		
ID3D11ShaderResourceView* t;
std::map<std::string,ID3D11ShaderResourceView*> TotalTexture;
std::vector<std::string> TotalTextureToLoad;
TotalTexture.insert
(
TotalTexture.end(),std::pair<std::string,ID3D11ShaderResourceView*>(TotalTextureToLoad[i],t)

);
while(!TotalTexture.empty())
{
	TotalTexture.begin()->second->Release();
	TotalTexture.erase(TotalTexture.begin());
}

 

 

 

 

 

    

PARTNERS