tags:

views:

61

answers:

1

Hi

I am observing a crash while calling the CMemFile::Detach() function

The exception with the call stack is as below

kernel32!RaiseException+53 e06d7363 00000001 00000003
msvcrt!_CxxThrowException+36 0103bb7c 7f0f6eac 00d8bf68
mfc42u!AfxThrowFileException+61 00000009 ffffffff 00000000
mfc42u!CMemFile::Seek+42 fffff159 00000001 00000194
mfc42u!CArchive::Flush+26 0103bbf0 7f02d05a 00d32388
mfc42u!CArchive::Close+a

This is occuring after i deserialize an object.

The versionable schema for the object seems to be correct.

Any idea as to wat may cause this problem

A: 

The function AfxThrowFileException has three parameters. The first parameter denotes the cause. In your case this is CFileException::badSeek. This can happen if the CMemFile pointer is changed without notifying the CArchive object. It is better to use the CArchive object to change the file pointer.

steve