delete this dangerous in duchain? [was: Crash in duchaintest]

Andreas Pakulat apaku at gmx.de
Mon Feb 2 17:46:15 UTC 2009


On 01.02.09 18:49:10, David nolden wrote:
> Am Sonntag 01 Februar 2009 18:32:53 schrieb Andreas Pakulat:
> > 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...
> 
> It copies away the required data before calling "delete this", so this should 
> be safe.
> 
> Actually, all the child-contexts and declarations should have been deleted 
> recursively from within DUContext::~DUContext. Then this call from within the 
> destructor of TopDUContextDynamicData would not happen. It's true that this 
> access to m_dynamicData is unsafe.
> 
> You should find out why the destructors are not called properly. Notice that 
> all the C++ contexts are either of type CppDUContext<DUContext> or 
> CppDUContext<TopDUContext>. It's possible that msvc also has some problems 
> with CppDUContext. You should put some log-output into ~CppDUContext and 
> ~DUContext to see whether the whole chain is called properly.

I tried to debug this a bit and apart from QVector being hardly debuggable
via msvc it seems that for some of the temporary contexts for templates
there's simply no clearContextIndex called at all, hence they're still in
that vector when the dynamic-data is deleted. But in fact the underlying
contexts have already been deleted -> BOOM :)

Is there a good way to print out what part of the text a context is for?
All I could get at is the kte-range which is 45-62 for the first that
crashes in the mentioned specializedTemplateTest.

How do I found out why this context is not deleted, apparently its not a
child anymore of any other context?

Andreas

-- 
You will be run over by a beer truck.




More information about the KDevelop-devel mailing list