gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-dev] Implement the XMLSocket.onConnect() callback


From: Ching-Yi Chan
Subject: [Gnash-dev] Implement the XMLSocket.onConnect() callback
Date: Mon, 18 May 2009 15:23:11 +0800

Hi,

I have read the XMLSocket_as.cpp, the XMLSocket.onConnect() callback does not work as the adobe player.
we use the adobe player the XMLSocket.onConnect(false) will be invoked when connection failed but not have the same effect in gnash.

I try use boost::thread to make an async-callback call, the callback like:

// XMLSocket.onConnect callback
void
xmlsocket_onConnect(const boost::intrusive_ptr<XMLSocket_as> ptr, const bool result){
     log_debug(_("XMLSocket.connect(): trying to call onConnect"));
     ptr->callMethod(NSV::PROP_ON_CONNECT, result);
     ptr->getVM().getRoot().addAdvanceCallback(ptr.get());
}


and call it in the connect function:

if (!ptr->connect(host, port))
{
// TODO: onConnect(false) should not be called here, but rather
// only if a failure occurs after the initial connection.
log_error(_("XMLSocket.connect(): connection failed"));
boost::thread onConnect(boost::bind(&xmlsocket_onConnect, ptr, false));
return as_value(false);
}


but something wrong at gc:

[New Thread 0xb3e66b90 (LWP 31602)]
31599:3018222480] 14:59:04 DEBUG: XMLSocket.connect(): trying to call onConnect
31599:3058760224] 14:59:04 DEBUG: Timer set
gtk-gnash: ../libbase/GC.h:232: void gnash::GC::addCollectable(const gnash::GcResource*): Assertion `self == mainThread' 失敗。

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb3e66b90 (LWP 31602)]
0xb7f7e424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7f7e424 in __kernel_vsyscall ()
#1  0xb7044640 in raise () from /lib/i686/cmov/libc.so.6
#2  0xb7046018 in abort () from /lib/i686/cmov/libc.so.6
#3  0xb703d5be in __assert_fail () from /lib/i686/cmov/libc.so.6
warning: (Internal error: pc 0xb7992632 in read in psymtab, but not in symtab.)

#4  0xb7992633 in gnash::GC::addCollectable (this=warning: (Internal error: pc 0xb7992580 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0xb7992632 in read in psymtab, but not in symtab.)

0x8a91628, item=0x8c3af80) at ../libbase/GC.h:232
#5  0xb798f4b7 in as_object (this=0x8c3af80) at ../libbase/GC.h:326
#6  0xb7b913d3 in CallFrame (this=0xb3e65e2c, funcPtr=0x8c39938) at CallStack.cpp:27
#7  0xb7982645 in gnash::as_environment::pushCallFrame (this=0x8c2e82c, func=0x8c39938) at as_environment.cpp:959
#8  0xb7a41f9f in gnash::swf_function::operator() (this=0x8c39938, address@hidden) at ./as_environment.h:506
#9  0xb7b8f9fe in gnash::call_method (address@hidden, address@hidden, this_ptr=0x8c39758, args={_M_ptr = 0xb3e66284}, super=0x0, callerDef=0x0)
    at action.cpp:65
#10 0xb798cf36 in gnash::as_object::callMethod (this=0x8c39758, methodName=91, address@hidden) at as_object.cpp:1228
#11 0xb7b0cf6f in gnash::xmlsocket_onConnect (ptr={p_ = 0xb3e66320}, result=true) at XMLSocket_as.cpp:252
#12 0xb7b0f4bd in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, void (*)(boost::intrusive_ptr<gnash::XMLSocket_as>, bool), boost::_bi::list2<boost::_bi::value<boost::intrusive_ptr<gnash::XMLSocket_as> >, boost::_bi::value<bool> > >, void>::invoke (
    address@hidden) at /usr/include/boost/bind.hpp:288
#13 0xb6f8bf4c in boost::function0<void, std::allocator<boost::function_base> >::operator() () from /usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1
#14 0xb6f8bb87 in ?? () from /usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1
#15 0xb77ab4c0 in start_thread () from /lib/i686/cmov/libpthread.so.0
#16 0xb70f96de in clone () from /lib/i686/cmov/libc.so.6


anyone can give me some suggestions.

more information:
modified XMLSocket_as.cpp http://pastie.org/481294
gdb message http://pastie.org/481295

reply via email to

[Prev in Thread] Current Thread [Next in Thread]