use own mutex for region iterator locking, not gui one

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2002-09-04 22:07:25 +00:00
parent 7e2f4683db
commit 2af6b4c37f

View File

@ -21,6 +21,7 @@
#include "wx/region.h"
#include "wx/gdicmn.h"
#include "wx/thread.h"
#include "wx/module.h"
#include <mgraph.hpp>
@ -290,6 +291,27 @@ wxRegionContain wxRegion::Contains(const wxRect& rect) const
// wxRegionIterator //
///////////////////////////////////////////////////////////////////////////////
#if wxUSE_THREADS
static wxMutex *gs_mutexIterator;
class wxMglRegionModule : public wxModule
{
public:
virtual bool OnInit()
{
gs_mutexIterator = new wxMutex();
return TRUE;
}
virtual void OnExit()
{
wxDELETE(gs_mutexIterator);
}
DECLARE_DYNAMIC_CLASS(wxMglRegionModule)
};
IMPLEMENT_DYNAMIC_CLASS(wxMglRegionModule, wxModule)
#endif
/*
* Initialize empty iterator
*/
@ -331,10 +353,11 @@ void wxRegionIterator::Reset(const wxRegion& region)
if (!region.Empty())
{
wxMutexGuiEnter();
#if wxUSE_THREADS
wxMutexLocker(*gs_mutexIterator);
#endif
gs_rectList = &m_rects;
M_REGION_OF(region).traverse(wxMGL_region_callback);
wxMutexGuiLeave();
m_currentNode = m_rects.GetFirst();
}
}