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
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]