cPluginLua:cResettable no longer shares CS with plugin.
This fixes locking the resettable while the plugin is already gone. Hopefully no deadlocks.
This commit is contained in:
parent
8a43da0723
commit
0f45d1fbe2
@ -63,12 +63,17 @@ void cPluginLua::Close(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify and remove all m_Resettables:
|
// Notify and remove all m_Resettables (unlock the m_CriticalSection while resetting them):
|
||||||
for (auto resettable: m_Resettables)
|
cResettablePtrs resettables;
|
||||||
|
std::swap(m_Resettables, resettables);
|
||||||
{
|
{
|
||||||
resettable->Reset();
|
cCSUnlock Unlock(Lock);
|
||||||
}
|
for (auto resettable: resettables)
|
||||||
m_Resettables.clear();
|
{
|
||||||
|
resettable->Reset();
|
||||||
|
}
|
||||||
|
m_Resettables.clear();
|
||||||
|
} // cCSUnlock (m_CriticalSection)
|
||||||
|
|
||||||
// Release all the references in the hook map:
|
// Release all the references in the hook map:
|
||||||
for (cHookMap::iterator itrH = m_HookMap.begin(), endH = m_HookMap.end(); itrH != endH; ++itrH)
|
for (cHookMap::iterator itrH = m_HookMap.begin(), endH = m_HookMap.end(); itrH != endH; ++itrH)
|
||||||
@ -1853,8 +1858,7 @@ void cPluginLua::CallbackWindowSlotChanged(int a_FnRef, cWindow & a_Window, int
|
|||||||
// cPluginLua::cResettable:
|
// cPluginLua::cResettable:
|
||||||
|
|
||||||
cPluginLua::cResettable::cResettable(cPluginLua & a_Plugin):
|
cPluginLua::cResettable::cResettable(cPluginLua & a_Plugin):
|
||||||
m_Plugin(&a_Plugin),
|
m_Plugin(&a_Plugin)
|
||||||
m_CSPlugin(a_Plugin.m_CriticalSection)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +84,8 @@ public:
|
|||||||
Protected against multithreaded access by m_CSPlugin. */
|
Protected against multithreaded access by m_CSPlugin. */
|
||||||
cPluginLua * m_Plugin;
|
cPluginLua * m_Plugin;
|
||||||
|
|
||||||
/** The mutex protecting m_Plugin against multithreaded access.
|
/** The mutex protecting m_Plugin against multithreaded access. */
|
||||||
Actually points to m_Plugin's internal m_CriticalSection in order to prevent deadlocks. */
|
cCriticalSection m_CSPlugin;
|
||||||
cCriticalSection & m_CSPlugin;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SharedPtr<cResettable> cResettablePtr;
|
typedef SharedPtr<cResettable> cResettablePtr;
|
||||||
|
Loading…
Reference in New Issue
Block a user