Welcome, Guest

Author Topic: engine.trigger with htmlElement as argument  (Read 662 times)

Fa

  • Posts: 7
    • View Profile
engine.trigger with htmlElement as argument
« on: January 08, 2018, 02:21:49 AM »
Hello,

I am trying to call an event in javscript with this as argument, but it makes Coherent GT 2.0 crash :(

On javascript, here is what I call :
Code: [Select]
engine.trigger("TestEvent", this);

this referes to a html div.


Here is the callstack:
Quote
>   CoherentUIGT.dll!nedalloc::nedpmalloc2(nedalloc::nedpool_t * p, unsigned __int64 size, unsigned __int64 alignment, unsigned int flags) Line 1980   C++
    WTF.dll!00007ffd9aca3f16()   Unknown
    WTF.dll!00007ffd9ac9424d()   Unknown
    WTF.dll!00007ffd9ac8d86e()   Unknown
    WTF.dll!00007ffd9ac9a67f()   Unknown
    CoherentGTJS.dll!00007ffd8a09c1e7()   Unknown
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::GetType(void * context, const void * value) Line 161   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 180   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 220   C++
    CoherentUIGT.dll!Coherent::UIGT::ContextDeserializer::ToBlobStream(const Coherent::UIGT::Value & value, Coherent::Blob::BlobOStream & stream) Line 209   C++    
    CoherentUIGT.dll!Coherent::UIGT::Array::Array(void * context, void * values, unsigned int size, Coherent::UIGT::Array::ArrayType type, bool isBlobBased, bool isRoot) Line 509   C++
    CoherentUIGT.dll!Coherent::UIGT::EventArguments::EventArguments(const Coherent::UIGT::EventArguments & rhs, bool isBlobBased) Line 879   C++
    CoherentUIGT.dll!Coherent::UIGT::ViewListenerEventTask::Callback::Callback(unsigned int viewId, const char * eventName, const Coherent::UIGT::EventArguments & eventArgs) Line 92   C++
    CoherentUIGT.dll!Coherent::UIGT::AsyncViewListener::OnCallback(const char * eventName, const Coherent::UIGT::EventArguments & arguments) Line 89   C++
    CoherentUIGT.dll!Coherent::UIGT::Detail::ViewBinder::CallOnCallback(const std::basic_string<char,std::char_traits<char>,Coherent::MemoryManagementGT::STLAllocator<char> > & name, const OpaqueJSValue * const * arguments, unsigned __int64 argumentsCount, unsigned __int64 argumentsToSkip) Line 1383   C++
    CoherentUIGT.dll!Coherent::UIGT::Detail::ViewBinder::TriggerEventNative(const OpaqueJSContext * context, unsigned __int64 argumentsCount, const OpaqueJSValue * const * arguments, const OpaqueJSValue * * exception) Line 1310   C++

Is there a way to pass an HTMLElement as argument ?

Tony

  • Administrator
  • *****
  • Posts: 28
    • View Profile
Re: engine.trigger with htmlElement as argument
« Reply #1 on: January 09, 2018, 09:09:13 AM »
Hi Fa,

Sending this as an argument to engine.trigger is not the recommended approach. You can use data binding to send data from JavaScript to C++ (or vise versa). There is more information on how to achieve this in our documentation. Additionally, you can also check out our data binding sample(Sample_Binding) which is included in the package.

To get a better idea of your use case, can you give us more details why you want to pass a whole HTML element to the C++ code?

Tony,
Support Engineer at Coherent Labs

Fa

  • Posts: 7
    • View Profile
Re: engine.trigger with htmlElement as argument
« Reply #2 on: January 11, 2018, 12:34:18 AM »
Hi Tony,

thanks for the answer.

Passing this as an argument was a mistake. But as it made my app crash, I wanted to see why...

Tony

  • Administrator
  • *****
  • Posts: 28
    • View Profile
Re: engine.trigger with htmlElement as argument
« Reply #3 on: January 11, 2018, 06:24:13 AM »
Hey Fa,

To investigate in more detail what might be causing the crash - could you submit a ticket at support@coherent-labs.com and send us the crash dump.

Tony,
Support Engineer at Coherent Labs
« Last Edit: January 12, 2018, 07:54:57 AM by Tony »

Tags: