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 class. 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! BUG: 310064
parent
21ba9aca
Please register or sign in to comment