App crashes when using QCoreApplication in library
Unsolved
General and Desktop
-
@kshegunov
now it crashes.QNetworkAccessManager *NETWORK_COMBINER_LIB::DownloadableContent::get_manager() { return (!this->manager ? (this->manager = new QNetworkAccessManager()) : this->manager); } void NETWORK_COMBINER_LIB::DownloadableContent::loadHeaders(QObject *parent) { printf("load-headers\n"); QNetworkAccessManager *pManager = this->get_manager(); printf("pManager\n"); connect(pManager, &QNetworkAccessManager::finished, this, &DownloadableContent::http_headers_loaded); pManager->head(this->gen_request()); }
@jamalabo said in App crashes when using QCoreApplication in library:
now it crashes.
Look at your debugger's stack trace to see why it crashed.
!this->manager ?
Did you initialize the pointer to
nullptr
? -
@jamalabo said in App crashes when using QCoreApplication in library:
yes it's initialized to
nullptr
OK, so it sounds like initializing
nullptr
stopped the crash.but still does nothing (the request is not sent)
Time to start debugging.
- What does your QNetworkRequest look like?
- Does the QNetworkAccessManager emit any other signals after you called
head()
? https://doc.qt.io/qt-5/qnetworkaccessmanager.html#signals - Does the QNetworkReply emit any signals after you called
head()
? (The QNetworkReply object is returned byQNetworkAccessManager::head()
) https://doc.qt.io/qt-5/qnetworkreply.html#signals