From 07d7a8eeff535c1be6f5ceb519371ff57b54c3a6 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Sun, 17 Mar 2013 21:58:56 +0000 Subject: [PATCH] Check for cloned handles when dumping (bug 5245, r=asherkin). --- core/HandleSys.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/core/HandleSys.cpp b/core/HandleSys.cpp index 133c054d..f9ea6771 100644 --- a/core/HandleSys.cpp +++ b/core/HandleSys.cpp @@ -1095,12 +1095,32 @@ void HandleSystem::Dump(HANDLE_REPORTER rep) const char *type = "ANON"; QHandleType *pType = &m_Types[m_Handles[i].type]; unsigned int size = 0; + unsigned int parentIdx; + bool bresult; if (pType->nameIdx != -1) { type = m_strtab->GetString(pType->nameIdx); } + + if ((parentIdx = m_Handles[i].clone) != 0) + { + if (m_Handles[parentIdx].refcount > 0) + { + size = 0; + bresult = true; + } + else + { + bresult = pType->dispatch->GetHandleApproxSize(m_Handles[parentIdx].type, m_Handles[parentIdx].object, &size); + } + } + else + { + bresult = pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size); + } + if (pType->dispatch->GetDispatchVersion() < HANDLESYS_MEMUSAGE_MIN_VERSION - || !pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size)) + || !bresult) { rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s", index, owner, type, "-1"); }