mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
[pykd_ext_2.0] fixed : issue 14066 (dbgCommand('q') leads to windbg hung)
git-svn-id: https://pykd.svn.codeplex.com/svn@91173 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
ad9a59f3b0
commit
2049c751a0
@ -144,11 +144,7 @@ public:
|
||||
PythonInterpreter(PyModule* mod) :
|
||||
m_module(mod)
|
||||
{
|
||||
PyThreadState* state = mod->Py_NewInterpreter();
|
||||
|
||||
m_module->PyThreadState_Swap(state);
|
||||
|
||||
m_state = m_module->PyEval_SaveThread();
|
||||
m_state = mod->Py_NewInterpreter();
|
||||
}
|
||||
|
||||
~PythonInterpreter()
|
||||
@ -214,6 +210,7 @@ public:
|
||||
if (module->m_globalInterpreter == 0)
|
||||
{
|
||||
module->PyEval_RestoreThread(module->m_globalState);
|
||||
module->checkPykd();
|
||||
module->m_globalInterpreter = new PythonInterpreter(module);
|
||||
}
|
||||
|
||||
@ -223,12 +220,12 @@ public:
|
||||
else
|
||||
{
|
||||
module->PyEval_RestoreThread(module->m_globalState);
|
||||
module->checkPykd();
|
||||
m_currentInterpreter = new PythonInterpreter(module);
|
||||
m_currentIsGlobal = false;
|
||||
}
|
||||
|
||||
m_currentInterpreter->m_module->PyEval_RestoreThread(m_currentInterpreter->m_state);
|
||||
m_currentInterpreter->m_module->checkPykd();
|
||||
module->PyThreadState_Swap(m_currentInterpreter->m_state);
|
||||
|
||||
return m_currentInterpreter;
|
||||
}
|
||||
@ -242,7 +239,6 @@ public:
|
||||
if (!m_currentIsGlobal)
|
||||
{
|
||||
delete m_currentInterpreter;
|
||||
|
||||
module->PyThreadState_Swap(module->m_globalState);
|
||||
module->m_globalState = module->PyEval_SaveThread();
|
||||
}
|
||||
@ -255,11 +251,6 @@ public:
|
||||
return m_modules.find(std::make_pair(majorVersion, minorVersion)) != m_modules.end();
|
||||
}
|
||||
|
||||
void checkPykd()
|
||||
{
|
||||
m_currentInterpreter->m_module->checkPykd();
|
||||
}
|
||||
|
||||
void stopAllInterpreter()
|
||||
{
|
||||
for (auto m : m_modules)
|
||||
@ -490,6 +481,8 @@ PyModule::PyModule(int majorVesion, int minorVersion)
|
||||
Py_Initialize();
|
||||
PyEval_InitThreads();
|
||||
|
||||
checkPykd();
|
||||
|
||||
m_globalState = PyEval_SaveThread();
|
||||
}
|
||||
|
||||
@ -518,9 +511,13 @@ void PyModule::deactivate()
|
||||
{
|
||||
delete m_globalInterpreter;
|
||||
m_globalInterpreter = 0;
|
||||
}
|
||||
|
||||
PyThreadState_Swap(m_globalState);
|
||||
}
|
||||
else
|
||||
{
|
||||
PyEval_RestoreThread(m_globalState);
|
||||
}
|
||||
|
||||
if (m_pykdInit)
|
||||
{
|
||||
@ -597,11 +594,6 @@ void stopAllInterpreter()
|
||||
PythonSingleton::get()->stopAllInterpreter();
|
||||
}
|
||||
|
||||
void checkPykd()
|
||||
{
|
||||
PythonSingleton::get()->checkPykd();
|
||||
}
|
||||
|
||||
void __stdcall Py_IncRef(PyObject* object)
|
||||
{
|
||||
PythonSingleton::get()->currentInterpreter()->m_module->Py_IncRef(object);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#define PYKDEXT_VERSION_MAJOR 2
|
||||
#define PYKDEXT_VERSION_MINOR 0
|
||||
#define PYKDEXT_VERSION_SUBVERSION 0
|
||||
#define PYKDEXT_VERSION_BUILDNO 8
|
||||
#define PYKDEXT_VERSION_BUILDNO 9
|
||||
|
||||
#define __VER_STR2__(x) #x
|
||||
#define __VER_STR1__(x) __VER_STR2__(x)
|
||||
|
Loading…
Reference in New Issue
Block a user