|
-
December 23rd, 2005, 12:24 AM
#1
STL access violation
Hello !
I have a problem in my solution which use extensively STL.
When we remove pointer from list<> in A.dll to B.dll [OK]
When we put back from B.dll to A.dll [ACCESS VIOLATION]
We have : prim.dll, env.dll and app.exe (multithread)
[prim.dll] Shape* newLine();
[app.exe] list<Shape*> obj;
[env.dll] list<Shape*> undo;
The senario :
[create line] Shape* line=newLine(); obj.push_back(line);
[delete line] obj.remove(line); undo.push_back(line);
[undo delete] obj.push_back(undo.front());
[problem ] obj.front()=0xfeeefeee
Object was never delete until now, but we got an invalid pointer. Your idea and comments would be very helpful.
Thanks.
-
December 23rd, 2005, 01:40 AM
#2
Re: STL access violation
There is no mistake between the sequence of calling list functions, I think u have to check either each dll returning valid pointer or not before calling push_back into the list.
Code:
The senario :
[create line] Shape* line=newLine();
obj.push_back(line);
[delete line] obj.remove(line);
undo.push_back(line);
Shape * pline = NULL;
pline = undo.front();
if(pline)
{
[undo delete] obj.push_back(pline);
[problem ] obj.front()=????????
}
It May helps u.
A Person who is polite is given goodness and a person who is away from Politeness is away from Goodness.
NAUMAAN
-
December 23rd, 2005, 01:41 AM
#3
Re: STL access violation
hi Naumaan,
Can u explaing ur problem properly..
i didnt understadn it
i didnt understand the dll part of it
-
December 23rd, 2005, 01:48 AM
#4
Re: STL access violation
 Originally Posted by ProElite
hi Naumaan,
Can u explaing ur problem properly..
i didnt understadn it
i didnt understand the dll part of it
I have no problem Pro , the OP( Orignal Poster ) is laysovann .
A Person who is polite is given goodness and a person who is away from Politeness is away from Goodness.
NAUMAAN
-
December 23rd, 2005, 01:54 AM
#5
Re: STL access violation
OOPs !!!

ProElite
-
December 23rd, 2005, 04:03 AM
#6
Re: STL access violation
Hello! Your check is good. But if there is no valid pointer, then the object is gone, and there is noway we can undo. Is there any other way?
-
December 23rd, 2005, 07:29 AM
#7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|