|
Boost Users : |
From: Aaron (yilu_at_[hidden])
Date: 2005-10-11 03:35:29
The code snippet:
struct Grepper
{
int nPriority;
boost::regex re;
pONGREPFOUNDCALLBACK pOnGrepFoundSymbols;
friend bool operator< (const Grepper& g1, const Grepper& g2)
{
return g1.nPriority > g2.nPriority;
}
};
if (...){
Grepper gp;
if (QueryGreppers(gp))
g_vecGreppers.push_back(gp);
}
bool QueryGreppers(Grepper& gp)
{
gp.nPriority = 1;
gp.re ="\\s*#define\\s+([^\\s]+)\\s+([^/\\r\\n]+)([^\\r\\n]*)";
gp.pOnGrepFoundSymbols = OnGrepSingleLineSymbols;
return true;
}
Program fails at gp.re = ...
The call stack is:
_CrtIsValidHeapPointer(const void * 0x012e61f8) line 1606
_free_dbg_lk(void * 0x012e61f8, int 1) line 1011 + 9 bytes
_free_dbg(void * 0x012e61f8, int 1) line 970 + 13 bytes
free(void * 0x012e61f8) line 926 + 11 bytes
operator delete(void * 0x012e61f8) line 7 + 9 bytes
boost::detail::simple_alloc::deallocate(void * 0x012e61f8, unsigned
int 1024) line 213 + 9 bytes
boost::detail::allocator_adapter<unsigned
char,boost::detail::simple_alloc>::deallocate(unsigned char *
0x012e61f8, unsigned int 1024) line 258
boost::re_detail::raw_storage<boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
>::resize(boost::re_detail::raw_storage<boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
> * const 0x0012eff0, unsigned int 1120) line 223
boost::re_detail::raw_storage<boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
>::extend(boost::re_detail::raw_storage<boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
> * const 0x0012eff0, unsigned int 268) line 131 + 27 bytes
boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
>::compile_set_aux(boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
> * const 0x0012efe8, ...) line 1145 + 17 bytes
boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
>::compile_set_simple(boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
> * const 0x0012efe8, boost::re_detail::re_syntax_base * 0x012e6534,
unsigned long 8, unsigned char 0) line 737 + 48 bytes
boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
>::set_expression(boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
> * const 0x0012efe8, const char * 0x0846601c `string', const char *
0x08466049, unsigned int 34055) line 1651 + 20 bytes
boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
>::set_expression(boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
> * const 0x0012efe8, const char * 0x0846601c `string', unsigned int
34055) line 238 + 59 bytes
boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
>::assign(const char * 0x0846601c `string', unsigned int 33031) line
89 + 20 bytes
boost::basic_regex<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
>::operator=(boost::basic_regex<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
> * const 0x0012efe8, const char * 0x0846601c `string') line 356
QueryGreppers(Grepper & {...}) line 35 + 17 bytes
What's wrong with it?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net