Hi 

I have a Class that instantiates a MallocMessageBuilder and initializes its 
root to a custom struct. I notice a segfault when I construct the custom 
struct's builder in the constructor's initializer list.

  *// Construction that leads to a seg fault*

  MyMessageBuilder() 

  : m_message(),

    m_myMsgBuilder(m_message.initRoot<MyMessage>())

  {

    // The program seg faults in the following line.

    m_myMsgBuilder.initSomeStruct();

  }


  *// Alternate construction does not crash*

  MyMessageBuilder() 

  : m_message(),

    m_myMsgBuilder(nullptr)

  {

    m_myMsgBuilder = m_message.initRoot<MyMessage>();

    m_myMsgBuilder.initSomeStruct();

  }


0x00000000004059a0 in 
capnp::_::DirectWireValue<MyMessage::Which>::set(MyMessage::Which) ()

0x00000000004056fe in void 
capnp::_::StructBuilder::setDataField<MyMessage::Which>(unsigned int, 
kj::NoInfer_<MyMessage::Which>::Type) ()

0x000000000040551d in MyMessage::Builder::initSomeStruct() ()


What could be causing the seg fault?


Thanks

Sune

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/23b59bc8-bfa3-4e3d-964d-7bfdf2fca5fe%40googlegroups.com.

Reply via email to