Archived

This forum has been archived. Please start a new discussion on GitHub.

IceStorm::TopicManagerPrx::checkedCast crash

Ice version (e.g., Ice 3.4.1)
Compiler version ( Visual Studio 2008 sp1)
Operating system (XP sp3)
Ice::ObjectPrx objPrx=ic->propertyToProxy("TopicManager.Proxy");
		IceStorm::TopicManagerPrx manager=IceStorm::TopicManagerPrx::checkedCast(objPrx);
		if(!manager)
		{
			cerr<<":invalid proxy"<<endl;
			return ;
		}

call stack
 	msvcr90d.dll!memcpy(unsigned char * dst=0x00ed23c0, unsigned char * src=0x00000000, unsigned long count=31)  Line 298	Asm
 	ice34d.dll!IceInternal::BasicStream::write(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & v=<Bad Ptr>, bool convert=false)  Line 464 + 0x2c bytes	C++
 	ice34d.dll!IceDelegateM::Ice::Object::ice_isA(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & __id=<Bad Ptr>, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > * context=[...]())  Line 1457	C++
 	ice34d.dll!IceProxy::Ice::Object::ice_isA(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & typeId=<Bad Ptr>, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > * context=[...]())  Line 134 + 0x28 bytes	C++
 	ice34d.dll!IceProxy::Ice::Object::ice_isA(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & typeId=<Bad Ptr>)  Line 178	C++
 	rtr.exe!IceInternal::checkedCastImpl<IceInternal::ProxyHandle<IceProxy::IceStorm::TopicManager> >(const IceInternal::ProxyHandle<IceProxy::Ice::Object> & b={...}, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > * context=[...]())  Line 899 + 0x30 bytes	C++
 	rtr.exe!IceInternal::checkedCastHelper<IceProxy::IceStorm::TopicManager,IceProxy::Ice::Object>(const IceInternal::ProxyHandle<IceProxy::Ice::Object> & b={...}, void * __formal=0x00000000, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > * ctx=[...]())  Line 99 + 0x11 bytes	C++
 	rtr.exe!IceInternal::ProxyHandle<IceProxy::IceStorm::TopicManager>::checkedCast<IceProxy::Ice::Object>(const IceInternal::ProxyHandle<IceProxy::Ice::Object> & r={...})  Line 276 + 0x15 bytes	C++
>	rtr.exe!initSub(IceInternal::Handle<Ice::Communicator> & ic={...})  Line 51 + 0xd bytes	C++
 	rtr.exe!main(int argc=1, char * * argv=0x00ec66b0)  Line 37 + 0xc bytes	C++
 	rtr.exe!WinMain(HINSTANCE__ * instance=0x00400000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x001520c9, int cmdShow=1)  Line 131 + 0x12 bytes	C++
 	rtr.exe!__tmainCRTStartup()  Line 578 + 0x35 bytes	C
 	rtr.exe!WinMainCRTStartup()  Line 403	C
 	kernel32.dll!7c82f23b() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ice34.dll!0053006e() 	
 	ice34.dll!0053006e() 	
 	ice34.dll!0053006e() 	
 	ice34.dll!0053006e() 	
 	ice34.dll!0053006e() 	


It seem that in checkedCastImpl , T::ice_staticId() get an invalid string. finally memcpy failed due to src is NULL, then program crashed.
emplate<typename P> P 
checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context* context)
{
    P d = 0;
    if(b.get())
    {
        typedef typename P::element_type T;

        d = dynamic_cast<T*>(b.get());
        if(!d && (context == 0 ? 
                  b->ice_isA(T::ice_staticId()) :
                  b->ice_isA(T::ice_staticId(), *context)))
        {
            d = new T;
            d->__copyFrom(b);
        }
    }
    return d;
}

Comments

  • benoit
    benoit Rennes, France
    Hi

    The stack trace mentions both the ice34.dll and ice34d.dll shared libraries. The most likely cause of this crash is a runtime library mix-up. See this FAQ for an explanation. You need to make sure to link with ice.lib if you compile a release version of your executable or with iced.lib if you compile a debug version.

    Cheers,
    Benoit.
  • thanks, Benoit

    you are right .
    All the libs used should be either debug or release,even qt's lib .