Click to See Complete Forum and Search --> : STL access violation


laysovann
December 22nd, 2005, 11:24 PM
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. :)

Naumaan
December 23rd, 2005, 12:40 AM
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.
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.

ProElite
December 23rd, 2005, 12:41 AM
hi Naumaan,
Can u explaing ur problem properly..
i didnt understadn it

i didnt understand the dll part of it

Naumaan
December 23rd, 2005, 12:48 AM
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 .

ProElite
December 23rd, 2005, 12:54 AM
OOPs !!!
:)



ProElite

laysovann
December 23rd, 2005, 03:03 AM
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? :)

Marc G
December 23rd, 2005, 06:29 AM
[ moved thread ]