ryan20fun's Profile
Reputation: 6
Worker
- Group:
- Active Members
- Active Posts:
- 109 (0.12 per day)
- Joined:
- 20-December 10
- Profile Views:
- 871
- Last Active:
Nov 13 2012 02:54 AM- Currently:
- Offline
Previous Fields
- Country:
- ZA
- OS Preference:
- Windows
- Favorite Browser:
- FireFox
- Favorite Processor:
- AMD
- Favorite Gaming Platform:
- PC
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Latest Visitors
-
Atli 
19 Nov 2011 - 02:15 -
gabehabe 
10 Nov 2011 - 05:20 -
Ryano121 
25 Sep 2011 - 07:23 -
stayscrisp 
21 Jun 2011 - 13:29 -
v0rtex 
19 Jun 2011 - 02:00 -
ButchDean 
13 Jun 2011 - 10:30 -
marinus 
05 Jun 2011 - 06:23 -
macosxnerd101 
01 Jun 2011 - 16:12 -
Patrunjel 
14 May 2011 - 12:15 -
Aphex19 
06 May 2011 - 09:42
Posts I've Made
-
In Topic: Cannot Get DLL From Visual C++ To Work On Any Machine But My Own?
Posted 5 Jan 2012
-
In Topic: Cannot Get DLL From Visual C++ To Work On Any Machine But My Own?
Posted 3 Jan 2012
-
In Topic: Vector of Double Pointer Problems
Posted 19 Dec 2011
-
In Topic: Vector of Double Pointer Problems
Posted 17 Dec 2011
Oler1s, on 17 December 2011 - 10:01 AM, said:By the way, you do not need to quote my whole post. I can scroll.
sorry
Oler1s, on 17 December 2011 - 10:01 AM, said:Quote
So, 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 ? )
Oler1s, on 17 December 2011 - 10:01 AM, said: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 )
Thanks EveryOne
-
In Topic: Vector of Double Pointer Problems
Posted 17 Dec 2011
Oler1s, on 16 December 2011 - 10:41 PM, said:> 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.
delete p;
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.
Quote
Only 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.
My Information
- Member Title:
- D.I.C Head
- Age:
- 21 years old
- Birthday:
- November 3, 1991
- Gender:
-
- Location:
- South Africa
- Interests:
-
Programeing 'ofcorse'
Camping & Hiking - Years Programming:
- 4
- Programming Languages:
- C++
Contact Information
- E-mail:
- Private
- Skype:
-
ryan20fun
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
ryan20fun has no profile comments yet. Why not say hello?