delete this dangerous in duchain? [was: Crash in duchaintest]
Andreas Pakulat
apaku at gmx.de
Sun Feb 1 17:32:53 UTC 2009
On 30.01.09 20:41:41, Andreas Pakulat wrote:
> Hi,
>
> happens when executing duchaintest, apparently in the
> spezializedTemplateTest().
>
> The crash is actually inside the assembler code for the return call in the
> TopDUContext::deleting() method. No idea what might be going on, maybe I
> can talk Frerich (our assembler guru) into doing some debugging with me
> next week...
>
> kdevplatformlanguage.dll!KDevelop::TopDUContext::deleting() Zeile
> 1314 + 0x6 Bytes C++
> kdevplatformlanguage.dll!KDevelop::DUContext::~DUContext() Zeile
> 559 + 0x8 Bytes C++
> kdev4cppduchain.dll!Cpp::CppDUContext<KDevelop::DUContext>::~CppDUContext<KDevelop::DUContext>()
> Zeile 601 + 0x2d Bytes C++
> kdev4cppduchain.dll!Cpp::CppDUContext<KDevelop::DUContext>::`scalar
> deleting destructor'() + 0x16 Bytes C++
> kdevplatformlanguage.dll!KDevelop::TopDUContextDynamicData::~TopDUContextDynamicData()
> Zeile 127 + 0x30 Bytes C++
> kdevplatformlanguage.dll!KDevelop::TopDUContextDynamicData::`scalar
> deleting destructor'() + 0x16 Bytes C++
> kdevplatformlanguage.dll!KDevelop::TopDUContext::deleteSelf()
> Zeile 897 + 0x1c Bytes C++
> kdevplatformlanguage.dll!KDevelop::DUChainPrivate::removeDocumentChainFromMemory(KDevelop::TopDUContext
> * context=0x050811c0) Zeile 332 C++
> kdevplatformlanguage.dll!KDevelop::DUChain::removeDocumentChain(KDevelop::TopDUContext
> * context=0x050811c0) Zeile 870 C++
> > duchaintest.exe!release(KDevelop::TopDUContext * top=0x050811c0)
> > Zeile 82 + 0x1d Bytes C++
> duchaintest.exe!TestDUChain::testSpecializedTemplates() Zeile 2289
> + 0x9 Bytes C++
Hitting this with openprojectpage.h now outside the test. I'm wondering
wether accessing m_dynamicData is actually a good idea at this point. After
all, ~DUContext is being called from ~TopDUContextDynamicData, hence
m_dynamicData might already have been deleted or is now inaccessible.
In particular I'm seeing a delete this _before_ deleting the dynamic data
and local attribute in ~TopDUContext. Now, you may call me a C++ newbie,
but that really doesn't look right, in particular accessing members of an
already-deleted object. It seems msvc puts member variable pointers onto
bogus adresses when deleting an object, as m_dynamicData value is 0xdddddd.
Moving the delete this to the end of the method fixes the crash here, but
is this "safe"? Was there a special intent for that delete call?
Andreas
> Andreas
>
> --
> Keep emotionally active. Cater to your favorite neurosis.
>
> _______________________________________________
> KDevelop-devel mailing list
> KDevelop-devel at kdevelop.org
> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
>
--
A few hours grace before the madness begins again.
More information about the KDevelop-devel
mailing list