[X2Go-Dev] Bug#522: X2Go issue (in src:x2goclient) has been marked as pending for release

Mihai Moldovan ionic at ionic.de
Fri Jun 27 16:30:11 CEST 2014


I would so reject this patch. It's logically flawed.

First:
106     QStringList args;
107     if ( argc > 1 )
108         args=app.arguments();

Later:
154         if(argc <=1)
155         {
156             args=app.arguments();
157         }

Remove those two occurrences and use:
106     QStringList args;
107     args=app.arguments();


The baseline issue has been args not populated with app.arguments(). It wasn't
uninitialized, but empty.

An empty list is basically fine, but this will crash:
161             QString executable=args[0];
162             args.pop_front();

args[0] is not defined in that case.

Even worse: the Qt documentation for pop_front() specifies: "The list must not
be empty."

Please, use proper logic and always set args to app.arguments() without this
nonsensical if (argc > 1) ... if (argc <= 1) tautology in two different places.


---

* On 27.06.2014 03:38 pm, Michael DePaulo wrote:
> However, Ionic and I were taking a look at the code last night, and we
> did not understand why "--child-process" is being added to the args
> list. It looks like you are adding it when it does not exist in the
> list. If so, why not just hardcode the behavior that --child-process
> invokes?

Having had a closer look at the code in question, adding --child-process is
fine. It's only added to the forked process's argument list.
You can't hardcode the behavior of --child-process, as it's not supposed to be
used when you start x2goclient.exe "normally".
In contrast, --child-process lets you determine whether a process is the forked
child process, or rather the manually by the user started main process.

Feel free to ignore this section, Alex.


Mihai

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4265 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20140627/e39e5063/attachment.bin>


More information about the x2go-dev mailing list