t-artistik / qtscriptgenerator

Automatically exported from code.google.com/p/qtscriptgenerator
0 stars 0 forks source link

QDomNode appendNode() broken due to bad parameter cast #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In the generated cpp for the QDomXXX wrappers, in the file 
qtscript_QDomNode.cpp, function qtscript_QDomNode_prototype_call(), for case 0 
("appendChild"), the the QDomNode argument is being treated as though it were 
being passed by value, when in fact is is passed by reference. The generated 
code is:

   case 0:
    if (context->argumentCount() == 1) {
        QDomNode _q_arg0 = qscriptvalue_cast<QDomNode>(context->argument(0));
        QDomNode _q_result = _q_self->appendChild(_q_arg0);
        return qScriptValueFromValue(context->engine(), _q_result);
    }

which fails because the initial cast fails. The following works, however:

   case 0:
    if (context->argumentCount() == 1) {
        QDomNode *_q_arg0 = qscriptvalue_cast<QDomNode *>(context->argument(0));
        QDomNode _q_result = _q_self->appendChild(*_q_arg0);
        return qScriptValueFromValue(context->engine(), _q_result);
    }

I think this occurs elsewhere in the generated code as well, but I have not 
verified.

Original issue reported on code.google.com by chen...@gmail.com on 30 Dec 2011 at 1:10