Hello,
I have a class CTest which has many instances of some class called CNetworkManager.
e.g., many functions in CTest create CNetworkManager objects. e.g.,
void CTest:f1()
{
CNetworkManager *p = new CNetworkManager();
//...do some stuff
// e.g., makePostRequest
}
void CTest:f2()
{
CNetworkManager *p = new CNetworkManager();
//...do some other stuff
//e.g., makePostRequest
}
void CTest:f1()
{
CNetworkManager *p = new CNetworkManager();
//...do some stuff
// e.g., makePostRequest
}
void CTest:f2()
{
CNetworkManager *p = new CNetworkManager();
//...do some other stuff
//e.g., makePostRequest
}
To copy to clipboard, switch view to plain text mode
CNetworkManager is used for network communication. Inside it uses a QNetworkAccessManager
object for that. I usually process a server response in the requestFinished of the CNetworkManager
class and call a CTest method (as callback -- and also pass the data from the server).
You can see I may have many instances of CNetworkManager in my app. My question is where
is it safe to delete these CNetworkManager objects ???? and how?
Thank you.
Bookmarks