+1  A: 

My guess is that you are running into a race condition with threading. Cb1 is reallocating the array while your parser is trying to use it. After the realloc the old address is no longer valid and that is where your invalid read is coming from. You'll need to put a lock (perhaps a reader/writer lock) around the array to keep from hitting this problem. If it's possible, try running this code single-threaded to see if the problem reproduces. If it doesn't then it's a threading problem, otherwise it's something else entirely.

Talljoe
That was one of my latest thoughts. I'll test this avenue.
John Bellone
Actually, I am not sure this is the case now that I think a little more. The CSV parser and cb1 are being executed from the same thread; csv_parse method from libcsv calls cb1 (and cb2) after each column and row are parsed respectively.The call to libworkbook (sheet_method_apply_cellarray) waits on the GDK drawing lock to perform anything.
John Bellone
I am adding the execution thread where the parser method is invoked; the cb1 method is static to this file.
John Bellone
You can also use Valgrind to detect threading-related issues: valgrind --tool=helgrind.
Laurynas Biveinis
This seems to be the problem, although right now I do not have access to helgrind on the machine I am debugging on. Hopefully I can check later in the week.
John Bellone