I m Using Win7 / VS2008 (9) SDK 6/7.1
i faced a problem in a code that i m using
the mini version of the code as follows
class CONNECTION
{
int/std::string/bool vars; // just to make it simple
CONNECTION ( int defaultvar );
CONNECTION ( const CONNECTION& copycon )
~CONNECTION ( );
DWORD static WINAPI staticstart( void *param ) //HACK to use createthread on classes
{ return ((CONNECTION *)param)->main); } // yea it works fine
DWORD main();
};
this class has no default constructor with a copy and a destructor all vars are copied fine and destructor leaves no memleaks, constructor is simple as assigning the paramters to a var .. all vars and code are omitted to make it simple and because they aren t the prob.
class main
{
std::vector<CONNECTION> con;
int addcon( int defaultvarofcon )
{
CONNECTION temp( defaultvar );
con.push_back( temp );
return con.size() - 1;
}
}
so far so good when i run a console test program that only have an include and this code
main mymainclass;
mymainclass.addcon( 0 );
program runs fine closes without errors
but when i add extra code like
main mymainclass;
mymainclass.addcon( 0 );
mymainclass.addcon( 1 );
mymainclass.addcon( 2 );
program crashes with access violation after checking my code twice i debugged it step by step on all threads i found out the main thread can read correct values of all vector class/elements in both main thread and worker thread ONLY if i m using one element at the vector
然而,如果使用像第二部法典这样不止一个版本的米,则无法获得有关自己深层所有要素(坏点)的数据,但主要线上的数据仍然正确,显示正确的价值。
谁能帮助我了解这一法典有什么错误?