Archived
This forum has been archived. Please start a new discussion on GitHub.
Ice client coredump on VC6.0
the definition as follows in interface:
module Demo
{
sequence<string> StrSeq;
class cApp
{
StrSeq sGsm;
};
interface Hello
{
nonmutating void sayHello(out cApp obj);
};
};
and the server implement in the HelloI.cpp( C++ on Linux)
void
HelloI::sayHello(cAppPtr& obj, const Ice::Current&) const
{
obj = new cApp;
obj->sGsm.push_back("123456789");
cout << "Hello World!" << endl;
}
the client implement in the Client.cpp(Vc6.0)
try
{
communicator = Ice::initialize(argc, argv);
HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy("hello:tcp -p 10000"));
if(!hello)
{
cerr << argv[0] << ": invalid proxy" << endl;
status = EXIT_FAILURE;
}
else
{
cAppPtr obj;
hello->sayHello(obj);
for( unsigned u=0; u<obj->sGsm.size(); u++)
{
cout << u << ":" << obj->sGsm << endl;
}
}
}
the result as follow:
0:123456789
Hello World!
as display above, the result is right, but when free the memory, the client is coredump, and the location is "decRef(this->_ptr);"
module Demo
{
sequence<string> StrSeq;
class cApp
{
StrSeq sGsm;
};
interface Hello
{
nonmutating void sayHello(out cApp obj);
};
};
and the server implement in the HelloI.cpp( C++ on Linux)
void
HelloI::sayHello(cAppPtr& obj, const Ice::Current&) const
{
obj = new cApp;
obj->sGsm.push_back("123456789");
cout << "Hello World!" << endl;
}
the client implement in the Client.cpp(Vc6.0)
try
{
communicator = Ice::initialize(argc, argv);
HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy("hello:tcp -p 10000"));
if(!hello)
{
cerr << argv[0] << ": invalid proxy" << endl;
status = EXIT_FAILURE;
}
else
{
cAppPtr obj;
hello->sayHello(obj);
for( unsigned u=0; u<obj->sGsm.size(); u++)
{
cout << u << ":" << obj->sGsm << endl;
}
}
}
the result as follow:
0:123456789
Hello World!
as display above, the result is right, but when free the memory, the client is coredump, and the location is "decRef(this->_ptr);"
0