Code review comment for lp://staging/~abreu-alexandre/webbrowser-app/intent

Revision history for this message
Olivier Tilloy (osomon) wrote :

> > In tests/unittests/intent-filter/tst_IntentFilterTests.cpp:
> >
> > 1004 + IntentFilter * pf = new IntentFilter(QString());
> > 1050 + IntentFilter * pf = new IntentFilter(filterFunctionSource);
> >
> > pf is leaked. Could it be instantiated on the stack instead?
>
> why 'need fixing'? I did it on purpose ... IntentFilter is a QObject which is
> not
> copy constructiblem and ... this is a test ...

I’m not sure I understand your point. The fact that it is a test doesn’t mean that it shouldn’t follow good practices and free memory after itself.
But really, why not instantiate the objects on the stack and let them be destroyed automatically when they go out of scope? I.e.:

    IntentFilter pf(QString());
    QVERIFY(pf.isValidIntentUri(intentUris) == isValid);

« Back to merge proposal