In these GFL callback functions, I use the IStream object pointer to access the Read() and Seek() methods.
Everything works OK unless the load is cancelled mid-way through, which can cause an access violation. If an IStream becomes invalid, the Read() and Seek() methods return a value other than S_OK. When this occurs, I return -1 from the GFL callback functions.
As you can see from the attached screen shot, the heap gets corrupted.
NOTE: the crash doesn't always occur, so it must depend on where in the load operation the abort takes place.
