PDA

View Full Version : Warning when cancel download file?



madawg
25th June 2018, 12:04
QCoreApplication::postEvent: Unexpected null receiver


I don't know call what.
I make a downloader into a app, when I cancel download, I waning on console.
I don't know how to debug with problem.

d_stranz
25th June 2018, 17:23
Well, with all the detailed information you have provided, I think the correct answer is that your program has a bug in it. If you find the bug and fix it, the warning should go away.

madawg
26th June 2018, 03:29
QNetworkReply *reply = QNetAccessMananger::get(request);
....
if (reply != nullptr)
{
reply->disconnect();
reply->abort();
reply->deleteLater();
reply = nullptr;
}
I used above code to stop download file.

d_stranz
26th June 2018, 05:25
That's very useful. What's "reply"? A pointer to something which you don't consider important enough to identify.

Come on. If you want help to try to solve your problem, you have to provide some information that actually tells us something about what you are doing. Otherwise, you're just wasting your time and ours. We don't have a copy of your code sitting on our desk. So how are we supposed to understand from 4 lines of meaningless code what you might be doing right or wrong?

madawg
27th June 2018, 08:22
I updated it:

QNetworkReply *reply = QNetAccessMananger::get(request);

ado130
28th June 2018, 10:37
I am afraid the get function is not static, so thus you will probably need something like this:


QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QNetworkReply *reply = manager->get(request);


qnetworkaccessmanager.html#details

madawg
29th June 2018, 11:41
sorry. It is not static, I only show it as detail more.