Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inconsistent, but frequent EXC_BAD_ACCESS access with sqlite3_step(statement)

I am getting frequent EXC_BAD_ACCESS crashes in iOS while executing this line:

while (sqlite3_step(statement) == SQLITE_ROW) {

}

Its used to deliver results in my (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath function.

Any ideas? The SQL etc looks fine, and the database is being updated in a background thread, after which I call the foreground thread to update UI.

like image 766
JeremyLaurenson Avatar asked Oct 23 '22 06:10

JeremyLaurenson


1 Answers

If you database is being updated in the background and you're accessing it in the foreground thread I'd highly recommend to use some kind of blocking mechanism to prevent race situation. I don't think sqlite is thread safe.

like image 199
sha Avatar answered Oct 27 '22 09:10

sha