[Debian-astro-maintainers] Bug#779046: Crash when clicking "Lookup locations on network" checkbox in Locations window

Adam Majer adamm at zombino.com
Tue Feb 24 23:03:00 UTC 2015


On Tue, Feb 24, 2015 at 11:36:25PM +0100, Tomasz Buchert wrote:
> On 24/02/15 16:54, Tomasz Buchert wrote:
> I found the problem - Location dialog launches Network Request
> asynchronously on every click of the checkbox. However each request
> uses the same global variable which creates a race condition. Our
> problem happens, because QNetworkReply that was already deleted is
> used by another async. request.
> I attach a patch that fixes this for me and I'm contacting stellarium
> devs to tell them about it.

Indeed, this would cause problems.

>  {
>  	StelLocation location;
>  	StelCore *core=StelApp::getInstance().getCore();
> +	QNetworkReply* networkReply = static_cast<QNetworkReply*>(sender());
>  	if (networkReply->error() == QNetworkReply::NoError) {
>  		//success
>  		// Tested with and without working network connection.

For this part of the patch, I would suggest this instead,

QNetworkReply *networkReply = qobject_cast<QNetworkReply*>(sender());
if (!networkReply)
    return;

Thank you for your work!

- Adam



More information about the Debian-astro-maintainers mailing list