[X2Go-Dev] Bug#522: X2Go issue (in src:x2goclient) has been marked as pending for release
Oleksandr Shneyder
o.shneyder at phoca-gmbh.de
Fri Jun 27 21:36:22 CEST 2014
Hello Mihai,
The list is never empty, it have at least 1. argument - it is always
executable name. I'll leave my solution here, because in a case of linux
or mac if x2goclient started without arguments list don't need to be
initialized. Actually, I can change argc<=1 to argc ==1 but in this case
it make no difference.
regards,
Alex
Am 27.06.2014 16:30, schrieb Mihai Moldovan:
> 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
>
--
-----------------------------------------------------------
Oleksandr Shneyder | Email: o.shneyder at phoca-gmbh.de
phoca GmbH | Tel. : 0911 - 14870374 0
Ludwig-Feuerbach-str. 18 | Fax. : 0911 - 14870374 9
D-90489 Nürnberg | Mobil: 0163 - 49 64 461
Geschäftsführung:
Dipl.-Inf. Oleksandr Shneyder
Amtsgericht München | http://www.phoca-gmbh.de
HRB 196 658 | http://www.x2go.org
USt-IdNr.: DE281977973
-----------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 242 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20140627/f0503b89/attachment.pgp>
More information about the x2go-dev
mailing list