jirentabu / crashrpt

Automatically exported from code.google.com/p/crashrpt
0 stars 0 forks source link

DestroyView fails in SharedMem implementation #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by zexspect...@gmail.com on 2 Jul 2011 at 2:44

GoogleCodeExporter commented 9 years ago
This is fixed in v.1.3.0

Original comment by zexspect...@gmail.com on 22 Oct 2011 at 11:02