[Boost-bugs] [Boost C++ Libraries] #2048: exception when I create boost::RegEx in destructor code flow

Subject: [Boost-bugs] [Boost C++ Libraries] #2048: exception when I create boost::RegEx in destructor code flow
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-06-25 13:05:52


#2048: exception when I create boost::RegEx in destructor code flow
---------------------------------------+------------------------------------
 Reporter: Boris <boris_k_at_[hidden]> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: regex
  Version: Boost 1.35.0 | Severity: Problem
 Keywords: exception SetExpression |
---------------------------------------+------------------------------------
 Hello!
 I use VC++ 2005 (sp1), boost 1_35_0
 See ** line. I have an exception at this point.

 This function (CTradeHourScheduler::IniFileName()) is used many time in my
 code. No any errors while
 programm init or while I use boost::RegEx in a programm flow.

 But, I see an exception when I create boost::RegEx while destructuor of
 some object is called.
 "Unhandled exception at 0x00470301 in TQServerII.exe: 0xC0000005: Access
 violation reading location 0x00000004."
 No memory leek.
 When I disable this function call I see no memory leek too.
 Can I use boost::RegEx in destructon? Thank you!

 Boris.



 CString CTradeHourScheduler::IniFileName(){
         TCHAR cTmpBuff[2000]={0};

         GetModuleFileName(NULL,cTmpBuff,2000);
         CString sAppPath=cTmpBuff;

         boost::RegEx Sometest;
 ** Sometest.SetExpression(CT2A(_T("^(.*)\\\\[^\\\\]+$"))); I
 have got an exception at this point while it is called from destructor
 // std::string
         CString strAppDir;
         Sometest.Match(CT2A(cTmpBuff));
         ....
 }

 Debugger call sack is here:

         TQServerII.exe!std::_Tree<std::_Tmap_traits<unsigned
 long,std::list<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const
 *>,std::allocator<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const *> > >::_Iterator<1>,std::less<unsigned
 long>,std::allocator<std::pair<unsigned long const
 ,std::list<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const
 *>,std::allocator<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const *> > >::_Iterator<1> > >,0> >::_Lbound(const
 unsigned long & _Keyval=1049) Line 1170 + 0x8 bytes C++
         TQServerII.exe!std::_Tree<std::_Tmap_traits<unsigned
 long,std::list<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const
 *>,std::allocator<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const *> > >::_Iterator<1>,std::less<unsigned
 long>,std::allocator<std::pair<unsigned long const
 ,std::list<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const
 *>,std::allocator<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const *> > >::_Iterator<1> > >,0>
>::lower_bound(const unsigned long & _Keyval=1049) Line 987 + 0x10 bytes
 C++
         TQServerII.exe!std::_Tree<std::_Tmap_traits<unsigned
 long,std::list<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const
 *>,std::allocator<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const *> > >::_Iterator<1>,std::less<unsigned
 long>,std::allocator<std::pair<unsigned long const
 ,std::list<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const
 *>,std::allocator<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
 const >,unsigned long const *> > >::_Iterator<1> > >,0> >::find(const
 unsigned long & _Keyval=1049) Line 961 + 0x10 bytes C++
         TQServerII.exe!boost::object_cache<unsigned
 long,boost::re_detail::w32_regex_traits_implementation<char>
>::do_get(const unsigned long & k=1049, unsigned int max_cache_size=5)
 Line 92 + 0x12 bytes C++
> TQServerII.exe!boost::object_cache<unsigned
 long,boost::re_detail::w32_regex_traits_implementation<char> >::get(const
 unsigned long & k=1049, unsigned int max_cache_size=5) Line 69 + 0x11
 bytes C++
 TQServerII.exe!boost::re_detail::create_w32_regex_traits<char>(unsigned
 long l=1049) Line 554 + 0xf bytes C++
 TQServerII.exe!boost::w32_regex_traits<char>::w32_regex_traits<char>()
 Line 573 + 0x16 bytes C++
 TQServerII.exe!boost::regex_traits<char,boost::w32_regex_traits<char>
>::regex_traits<char,boost::w32_regex_traits<char> >() Line 75 + 0xf
 bytes C++
 TQServerII.exe!boost::regex_traits_wrapper<boost::regex_traits<char,boost::w32_regex_traits<char>
>
>::regex_traits_wrapper<boost::regex_traits<char,boost::w32_regex_traits<char>
> >() Line 169 + 0xf bytes C++
 TQServerII.exe!boost::re_detail::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char>
>
>::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char>
> >() Line 61 + 0x4a bytes C++
 TQServerII.exe!boost::re_detail::basic_regex_implementation<char,boost::regex_traits<char,boost::w32_regex_traits<char>
>
>::basic_regex_implementation<char,boost::regex_traits<char,boost::w32_regex_traits<char>
> >() Line 93 + 0xf bytes C++
 TQServerII.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char>
> >::do_assign(const char * p1=0x0012ede0, const char * p2=0x0012edee,
 unsigned int f=262144) Line 525 + 0x22 bytes C++
 TQServerII.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char>
> >::assign(const char * p1=0x0012ede0, const char * p2=0x0012edee,
 unsigned int f=262144) Line 263 C++
 TQServerII.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char>
> >::assign(const char * p=0x0012ede0, unsigned int f=262144) Line 248
 C++
 TQServerII.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char>
> >::set_expression(const char * p=0x0012ede0, unsigned int f=0) Line 467
 C++
         TQServerII.exe!boost::RegEx::SetExpression(const char *
 p=0x0012ede0, bool icase=false) Line 177 + 0x13 bytes C++
 *** TQServerII.exe!CTradeHourScheduler::IniFileName() Line 81 + 0x3f
 bytes C++
         TQServerII.exe!CTradeHourScheduler::SaveData() Line 28 + 0xc
 bytes C++
         TQServerII.exe!CTradeHourScheduler::~CTradeHourScheduler() Line
 25 C++
         TQServerII.exe!CTradeHourScheduler::`scalar deleting destructor'()
 + 0xf bytes C++
         TQServerII.exe!CTQServerIIApp::~CTQServerIIApp() Line 104 + 0x22
 bytes C++
         TQServerII.exe!`dynamic atexit destructor for 'theApp''() + 0xd
 bytes C++
         msvcr80d.dll!doexit(int code=20, int quick=0, int retcaller=0)
 Line 553 C
         msvcr80d.dll!exit(int code=20) Line 398 + 0xd bytes C
         TQServerII.exe!__tmainCRTStartup() Line 610 C
         TQServerII.exe!wWinMainCRTStartup() Line 414 C
         KERNEL32.DLL!7c4e87f5()
         [Frames below may be incorrect and/or missing, no symbols loaded
 for KERNEL32.DLL]

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/2048>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:58 UTC