Reputation: 6 Worker
- Active Members
- Active Posts:
- 109 (0.12 per day)
- 20-December 10
- Profile Views:
- Last Active:
- Nov 13 2012 02:54 AM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Who Cares
- Dream Kudos:
Posts I've Made
Posted 5 Jan 2012
I'm about to make a video if this doesn't work. How do I go about doing this?
what do you mean exactly ?
if you mean a video of build / deployment etc, you could use "Cam Studio"(camstudio.org).
Posted 3 Jan 2012
Posted 19 Dec 2011
Posted 17 Dec 2011By the way, you do not need to quote my whole post. I can scroll.
QuoteSo, somehow, your code already calls delete between allocation and when you expect to free that allocated block.when i pushed the pointer onto the vector and then released then deleted the resource the code caused an exception because the pointer in the vector pointed to memory that was deleted.
So the correct approach at this point is to figure out why your code is freeing that memory when you don't want it to free, right?
The wrong approach is to switch around types in hopes the problem will go away.
i just relized now that what i was doing was bad, i was using new from a DLL and then calling delete from the exe( is the reason why this did not blow up because im using the same runtim for both ? )
It looks like you're emulating the Direct3D's use of double pointers without understanding why they do that. So in your code, I see no reason for a double pointer, yet you're using them everywhere. It's bizarre.
your spot on, i used that because i followed a books code on how to load DLL's at runtime for the graphics section of the engine.
so why are double pointers used ?
so im going to rework the classes a bit so that they request removel of themselves instead of trying to do somthing that was proberbly imposible( checking if the pointer was deleted )
Posted 17 Dec 2011> so how would i keep track of the pointer without uing a double pointer ?
I don't see why you can't.
> because the vector just store a copy of the pointer
Yes, but you don't care about this. Think about how you would free the resource.
Let me ask you this. What matters here? The value of p, or whether p was the original pointer or a copy? Let me put it another way, is this invalid:
int * a = new int; int * b = a; delete b;
Do you think that is invalid? If no, then you think a copy is fine. Which is inconsistent with your argument. If you say it is invalid, then you believe the argument to the delete operator is the original variable, which is quite wrong.
QuoteOnly if you discard the pointer itself. If you copy it around, you still have that value.there is a problem because im trying to release something that does not exist any more.
when i pushed the pointer onto the vector and then released then deleted the resource the code caused an exception because the pointer in the vector pointed to memory that was deleted.
so i asked the question here to see if any one knew how to do what i was doing slightly diffeently.
i could just make the resource remove itself from the vector( i have no problem with that ) i just want to find out how to do this so i know what to do if i were to do something similar in the future.
- Member Title:
- D.I.C Head
- 21 years old
- November 3, 1991
- South Africa
Camping & Hiking
- Years Programming:
- Programming Languages: