Re: [Quickfix-developers] problem when message.setField method is called
Brought to you by:
orenmnero
From: Mikhail V. <mve...@gm...> - 2009-12-10 12:56:20
|
You may want to consider using specific message class defined rather then using the underlying base. - Regards, Mikhail Veygman -----Original Message----- From: Brian Hill <bh...@pe...> To: qui...@li... <qui...@li...> Subject: [Quickfix-developers] problem when message.setField method is called Date: Wed, 9 Dec 2009 11:54:02 -0600 QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html Hi, If I modify a FIX message by calling the setField method, I get a segmentation fault when the destructor of the FIX message is called. I am using the latest QuickFIX, Ubuntu 4.1.2-16, and gcc 4.1.3. I have debugged and searched everywhere, but can't find a solution. Any help would be appreciated. Please see below for details. Thank you, Brian #################################### My Program #################################### void testMessage() { cout << "Creating message..." << endl; FIX::Message message; cout << "Adding field..." << endl; message.setField(35, "A"); // message.setField(FIX::MsgType("A")); // it doesn't matter which way I set the field // message.setField(55, "IBM"); // it doesn't matter which field I set } int main(int argc, const char *argv[]) { testMessage(); return 0; } #################################### GDB Output #################################### (gdb) run Starting program: /home/user/workspace/Client/Debug/Client [Thread debugging using libthread_db enabled] [New Thread -1213826560 (LWP 12088)] Creating message... Adding field... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1213826560 (LWP 12088)] 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 (gdb) backtrace #0 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 #1 0xb7e6083c in __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<int const, FIX::FieldBase> >, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate (this=0xbfba0dfc, __p=0x8053230, __n=1) at /usr/include/c++/4.1.3/ext/mt_allocator.h:721 #2 0xb7e60938 in std::_Rb_tree<int, std::pair<int const, FIX::FieldBase>, std::_Select1st<std::pair<int const, FIX::FieldBase> >, FIX::message_order, __gnu_cxx::__mt_alloc<std::pair<int const, FIX::FieldBase>, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_erase (this=0xbfba0dfc, __x=0x8053230) at /usr/include/c++/4.1.3/bits/stl_tree.h:362 #3 0xb7eb75c9 in FIX::FieldMap::clear (this=0xbfba0df8) at /usr/include/c++/4.1.3/bits/stl_tree.h:692 #4 0xb7eb76a0 in ~FieldMap (this=0xbfba0df8) at FieldMap.cpp:35 #5 0x0804b3a5 in ~Message (this=0xbfba0df8) at /home/user/quickfix/include/quickfix/Message.h:57 #6 0x0804a535 in testMessage () at ../Main.cpp:24 #7 0x0804a5bb in main (argc=8, argv=0xbfba1264) at ../Main.cpp:30 #################################### FieldMap.cpp - WHERE I THINK THE PROBLEM IS #################################### The destructor gets called: --------------------------- FieldMap::~FieldMap() { QF_STACK_IGNORE_BEGIN clear(); QF_STACK_IGNORE_END } The clear method gets called: ----------------------------- void FieldMap::clear() { QF_STACK_PUSH(FieldMap::clear) m_fields.clear(); // ####### The clear method is called on an stl::multimap and this is where the seg fault occurs Groups::iterator i; for ( i = m_groups.begin(); i != m_groups.end(); ++i ) { std::vector < FieldMap* > ::iterator j; for ( j = i->second.begin(); j != i->second.end(); ++j ) delete *j; } m_groups.clear(); QF_STACK_POP } STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers |