Revision d051357...

Go back to digest for 2nd December 2012

Features in Development Tools

Milian Wolff committed changes in [kdevplatform/tabbed-filetemplate-preview] /:

Create a singleton TemplateEngine that owns the Grantlee engine.

Grantlee tries to unload plugins when the engine is unloaded which
is hazardous and can lead to random crashes.

This also makes more sense from the API point of view since the
engine should not have a 1to1 relationship to a Grantle::Context.
Instead, that should be a 1toN relationship.

I have a bad feeling though: The ArchiveTemplateLoader, which get
registered to the Engine, store a raw KArchiveDirectory* pointer
which will probably be invalid as soon as the KArchive gets destroyed.
This just begs to break down eventually, yet I do not see a way to
unload a template loader from Grantlee. Probably we should refactor
the ArchiveTemplateLoader to reflect its temporary nature. I think
a RAII pattern should work, paired with a single ArchiveLoader in
the engine that supports multiple archives registered by the RAII

Anyhow even without the above this patch seems to resolve the crahes
in the new tabbed file template preview. Many thanks to Olivier JG
for investigating this issue!

File Changes

Added 3 files
  • /codegen
  •   language/templateengine.cpp
  •   language/templateengine.h
  •   language/templateengine_p.h
Modified 6 files
  •   language/CMakeLists.txt
  •   language/codegen/templateclassgenerator.cpp
  •   language/codegen/templateclassgenerator.h
  •   language/codegen/templaterenderer.cpp
  •   language/codegen/templaterenderer.h
  •   plugins/filetemplates/templateclassassistant.cpp
9 files changed in total