The implementation of DestroyView in the CSharedMem class will usually not call
UnmapViewOfFile because CreateView will call MapViewOfFile with a base offset
which is a multiple of m_dwAllocGranularity and save it to the set of views.
DestroyView then checks the pointer returned by CreateView (which is generally
differs) with the set and fails to find it.
The solution is to use a std::map instead of std::set to keep track of the
views:
Change one line in SharedMem.h:
std::map<LPBYTE, LPBYTE> m_aViewStartPtrs;
(instead of std::set<LPBYTE> m_aViewStartPtrs;)
and change the implementation in SharedMem.cpp such that the key is the LPBYTE
returned by CSharedMem::CreateView and the value is the pointer returned by
MapViewOfFile in CSharedMem::CreateView. Patched files are attached.
Original issue reported on code.google.com by asch...@gwdg.de on 30 Jun 2011 at 9:35
Original issue reported on code.google.com by
asch...@gwdg.de
on 30 Jun 2011 at 9:35Attachments: