Grantlee problems

Lubomir I. Ivanov neolit123 at gmail.com
Thu Jul 30 09:25:39 PDT 2015


On 29 July 2015 at 16:59, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> On Jul 29, 2015, at 2:05 AM, Robert Helling <helling at lmu.de> wrote:
>
> Hi,
>
> as I said already on IRC, somehow, on my Mac, grantlee does not fill in the
> template (no dive data is entered). In addition I get some error messages on
> the console which do not tell me a lot and also the data types that come
> with grantlee are also not easy for me to look into with the debugger. Here
> is what happens in detail. I am single stepping through printer.cpp.
>
> In line 87  Grantlee::Template t =
> m_engine->loadByName(PrintOptions->p_template);
>
>
> This produces the error
>
> QObject: Cannot create children for a parent that is in a different thread.
> (Parent is Grantlee::Parser(0x7fff5fbfb8f8), parent's thread is
> QThread(0x104d2da60), current thread is QThread(0x11d4b9240)
> QObject: Cannot create children for a parent that is in a different thread.
> (Parent is Grantlee::Parser(0x7fff5fbfb8f8), parent's thread is
> QThread(0x104d2da60), current thread is QThread(0x11d4b9240)
> QObject::setParent: Cannot set parent, new parent is in a different thread
>
>
> My guess is that this is what really causes the problems. Somehow the
> template
> ends up not being loaded correctly or not being connected correctly.
>
> One thing to do here is to compile grantlee with debugging and step into the
> calls.
>
>         m_engine->addTemplateLoader(m_templateLoader);
>
> in line 60 of templatelayout.cpp appears to succeed. Then what's different
> with the
> loadByName() call in line 87?
>

without looking at the Grantlee source, i think it uses threads for the loading.
what i suggested to Robert is to try to remove the "this" inside the
parentheses here:
m_engine = new Grantlee::Engine(this); // <---
as we manage the m_engine disposal manually.

googling about similar Qt errors suggested that somehow the explicit
parenthood may cause it (this = the parent QObject of m_engine).

> Don't know how to handle metatype
>
>
> So this means it can't figure out how to handle the parts in the template
> that
> are our types (so things like "{{ print_options.grayscale }};")
> The only place this message is printed is in
> templates/lib/customtyperegistry.cpp
> in line 56
>     if ( !types.contains( id ) ) {
>       qWarning() << "Don't know how to handle metatype" <<
> QMetaType::typeName( id );
> so put a breakpoint there and try to figure out what's going wrong.
>

i'm not sure, the error could be misleading and that the template was
not loaded correctly.

either way, someone who can reproduce the issue needs to debug it.
BTW does anyone else get that on OSX?

lubomir
--


More information about the subsurface mailing list