
Hello, I am having an issue using the regex library. I am developing in VC7 and this issue occurs with both Boost 1.33.0 and 1.33.1. I have recently tried to start retrieving capture information in the regex matches by using the match_result and sub_match classes. In order to use these classes, the compile flag BOOST_REGEX_MATCH_EXTRA is required to be turned on (enabled in user.hpp). With the library is built with this flag on, I will get the following trap when the method calling regex_match() returns. An unhandled exception of type 'System.NullReferenceException' occurred in tg12.exe Additional information: Object reference not set to an instance of an object This exception appears to occur in the cleanup logic of the ~match_results() destructor. I have yet to make any changes to the code to use the match_results object. In other words, the code I am using worked previously without the BOOST_REGEX_MATCH_EXTRA flag enabled. Are there any compiler options required? The stack trace is below. Thanks, Marty
DtmfGrammarManager.dll!std::vector ::const_iterator>,std::allocator DtmfGrammarManager.dll!std::vector ::const_iterator>,std::allocator DtmfGrammarManager.dll!std::vector ::const_iterator>,std::allocator DtmfGrammarManager.dll!boost::checked_delete ::const_iterator>,std::allocator DtmfGrammarManager.dll!boost::scoped_ptr ::const_iterator>,std::allocator DtmfGrammarManager.dll!boost::sub_match ::const_iterator>::~sub_match DtmfGrammarManager.dll!boost::sub_match (boost::sub_match DtmfGrammarManager.dll!std::allocator ::destroy(boost::sub_match DtmfGrammarManager.dll!std::_Destroy_range ::const_iterator>,std::allocator DtmfGrammarManager.dll!std::_Destroy_range ::const_iterator>,std::allocator DtmfGrammarManager.dll!std::vector ::const_iterator>,std::allocator DtmfGrammarManager.dll!std::vector ::const_iterator>,std::allocator DtmfGrammarManager.dll!std::vector ::const_iterator>,std::allocator DtmfGrammarManager.dll!boost::match_results ::const_iterator,std::allocator DtmfGrammarManager.dll!CDtmfGrammar_custom::check(const
std::basic_string

Marty Eaves wrote:
I am having an issue using the regex library. I am developing in VC7 and this issue occurs with both Boost 1.33.0 and 1.33.1. I have recently tried to start retrieving capture information in the regex matches by using the match_result and sub_match classes. In order to use these classes, the compile flag BOOST_REGEX_MATCH_EXTRA is required to be turned on (enabled in user.hpp). With the library is built with this flag on, I will get the following trap when the method calling regex_match() returns.
Just a clarification: you only need that define if you want extended capture information. You can access regular Perl style marked sub-expressions perfectly well without it.
An unhandled exception of type 'System.NullReferenceException' occurred in tg12.exe
Additional information: Object reference not set to an instance of an object
This exception appears to occur in the cleanup logic of the ~match_results() destructor. I have yet to make any changes to the code to use the match_results object. In other words, the code I am using worked previously without the BOOST_REGEX_MATCH_EXTRA flag enabled. Are there any compiler options required?
No none, if I'm reading your stack trace right it's std::vector that's causing the failure: there's nothing fancy going on inside sub_match just a scoped_ptr to a vector or sub_matches. Do you have a test case I can look at? If you're using managed code (looks like you are?) you might want to double check to see if there are any known issues using that with the STL. John.
participants (2)
-
John Maddock
-
Marty Eaves