Re: EXC_BAD_ACCESS after query.storein()
Posted by:
Alan Shank
Date: February 16, 2011 04:54PM
I have gathered some more information after debugging the program in XCode.
vector<deepSkyStruct> resvec; // deepSkyStruct is an ssqls structure
Here is the calling sequence:
query.storein(resvec); // this is in mycode
storein(Container & con); // in the Mysql++ library
storein(con, str(template_defaults) );
storein_sequence(con, s); // s is a const SQLTypeAdapter
UseQueryResult result = use(s);
while(1) {MYSQL_ROW d = result.fetch_raw_row();
the UseQueryResult object result has a private member result_ with these members:
counted_
refs_
The first time I call query.storein(resvec), after use(s), the result object has these values:
counted_ = 0x5016f0
refs = 0x501cd0
The code works fine.
When, after another query to a different table, I call query.storein(resvec2), after the use(s), the members counted_ and refs_ are both 0x0. Then, when result.fetch_raw_row is called, the program gets the EXC_BAD_ACCESS error. The debugger window shows this:
0x98d17a7c <+0000> push ebp
0x98d17a7d <+0001> mov ebp,esp
0x98d17a7f <+0003> sub esp,0x18
0x98d17a82 <+0006> mov eax,DWORD PTR [ebp+0x8]
0x98d17a85 <+0009> mov DWORD PTR [esp+0xc],0x0
0x98d17a8d <+0017> mov edx,DWORD PTR [eax]
the last line is highlighted and a red arrow points to it.
So far, no one has addressed this issue. I have also posted it on one of the Mac forums.
Cheers,
Alan Shank
Woodland, CA