diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-06-30 16:15:24 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-06-30 17:15:21 +0100 |
commit | cc0e7c73343c02708af6a5f851e2a791631c89b2 (patch) | |
tree | 1ce395a3965d5d9c8c66cb33871f7da80555ff39 /wrappers | |
parent | 3615c3435decb91d746f952435e4d60b50c304ae (diff) |
dxgitrace: Never attempt to delete a wrapper.
It's not safe, as we're not sure exactly which wrapper class we have.
This fixes the "unexpected virtual method" errors introduced with
earlier changes.
Diffstat (limited to 'wrappers')
-rw-r--r-- | wrappers/trace.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/wrappers/trace.py b/wrappers/trace.py index 41a99cfc..242785c3 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -727,7 +727,7 @@ class Tracer: print "{" print "private:" print " %s(%s * pInstance);" % (wrapperInterfaceName, interface.name) - print " virtual ~%s();" % wrapperInterfaceName + print " ~%s(); // Not implemented" % wrapperInterfaceName print "public:" print " static %s* _create(const char *entryName, %s * pInstance);" % (wrapperInterfaceName, interface.name) print " static void _wrap(const char *entryName, %s ** ppInstance);" % (interface.name,) @@ -745,7 +745,7 @@ class Tracer: print r'private:' print r' void _dummy(unsigned i) const {' - print r' os::log("error: %%s: unexpected virtual method %%i of instance pWrapper=%%p pvObj=%%p pVtbl=%%p\n", "%s", i, this, m_pInstance, m_pVtbl);' % interface.name + print r' os::log("error: %%s: unexpected virtual method %%i of instance pvObj=%%p pWrapper=%%p pVtbl=%%p\n", "%s", i, m_pInstance, this, m_pVtbl);' % interface.name print r' warnVtbl(m_pVtbl);' print r' warnVtbl(getVtbl(m_pInstance));' print r' trace::localWriter.flush();' @@ -790,14 +790,6 @@ class Tracer: print '}' print - # Destructor - print '%s::~%s() {' % (wrapperInterfaceName, wrapperInterfaceName) - if debug: - print r' os::log("%s::Release: deleted pvObj=%%p pWrapper=%%p pVtbl=%%p\n", m_pInstance, this, m_pVtbl);' % iface.name - print r' g_WrappedObjects.erase(m_pInstance);' - print '}' - print - baseMethods = list(iface.iterBaseMethods()) for base, method in baseMethods: self.base = base @@ -822,8 +814,8 @@ class Tracer: print r' Wrap%s *pWrapper = (Wrap%s *)it->second;' % (iface.name, iface.name) print r' assert(pWrapper);' print r' assert(pWrapper->m_dwMagic == 0xd8365d6c);' - print r' if (pWrapper->m_pInstance == pObj &&' - print r' pWrapper->m_pVtbl == getVtbl(pObj) &&' + print r' assert(pWrapper->m_pInstance == pObj);' + print r' if (pWrapper->m_pVtbl == getVtbl(pObj) &&' print r' pWrapper->m_NumMethods >= %s) {' % len(baseMethods) if debug: print r' os::log("%s: fetched pvObj=%p pWrapper=%p pVtbl=%p\n", entryName, pObj, pWrapper, pWrapper->m_pVtbl);' @@ -831,7 +823,9 @@ class Tracer: print r' *ppObj = pWrapper;' print r' return;' print r' } else {' - print r' delete pWrapper;' + if debug: + print r' os::log("%s::Release: deleted pvObj=%%p pWrapper=%%p pVtbl=%%p\n", pWrapper->m_pInstance, pWrapper, pWrapper->m_pVtbl);' % iface.name + print r' g_WrappedObjects.erase(pObj);' print r' }' print r' }' for childIface in getInterfaceHierarchy(ifaces, iface): |