At least not intentionally, here is the code: [...]
Anything obviously wrong with this?
Nothing do with your problem (which I see you've already solved), but your constructor should at the very least initialize
m_lpDevice to a null pointer and not just leave it pointing at some random address. What would be even better is if you could ditch your
Init() method and pass lpDevice in the constructor ... that's what constructors are for after all.
Also, that
m_MapTextures.clear(); call in your destructor is pointless. This happens implicitly when the map is destroyed.
Next:
map<string, LPDIRECT3DTEXTURE9>::iterator result;
result = m_MapTextures.find(str);
Why not just
const map<string, LPDIRECT3DTEXTURE9>::iterator result = m_MapTextures.find(str);
?
When ever possible, you should make declarations double over as initializations. That way you can often make variables const (as in the example above since you didn't have to change
result after initializing it), which helps readability and makes it easier to reason about existing code (for instance when one of your colleages has to understand code that you wrote).
Next issue,
D3DXGetImageInfoFromFile() and
D3DXCreateTextureFromFileEx Function() both have return values, and the reason they do so is not so you can be a lazy coder and just ignore them. Both of these functions can fail and the way to check for that is to inspect their return values. You should never just assume that a function will probably work if the documentation says that it can fail. Check the return value and if it denotes failure, do something about it ... throw an exception, bring up a message box or at least write an error message to a log file.
EDIT: How did I forget my favorite issue??
You should make your class uncopyable by declaring a private copy constructor and a private copy assignment operator and implementing neither. Because otherwise you'll get the compiler default copy constructor / copy assignment operator, which would just copy your instance bit by bit, and the way your class is implemented, that would result in disaster when your destructor runs.