diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-09-12 10:56:00 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-09-12 11:46:54 -0700 |
commit | 051bf8e79c99699704032b7b943459a30aae22c8 (patch) | |
tree | c3cc9d5c0349f2d568028c89ed3d560247939a19 | |
parent | ee58ffc1da71d296fdae869dbaaa74a1c4a6c664 (diff) |
libqtappfw: remove deleteLater instances that aren't usedguppy_6.90.0guppy/6.90.06.90.0
Remove several deleteLater calls that should have been delete's.
This should solve race conditions that an object calls deleteLater(), and leaves
scope before the QT main loop is called.
Outcome of the race condition is that sometimes the memory allocator reallocates it
to another message and causes a crash.
Bug-AGL: SPEC-1680
Change-Id: Ic83d8c6c204c6e3248bbe9a9def1842e1e384b2b
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r-- | bluetooth/bluetooth.cpp | 14 | ||||
-rw-r--r-- | mediaplayer/mediaplayer.cpp | 6 | ||||
-rw-r--r-- | messageengine.cpp | 1 | ||||
-rw-r--r-- | network/network.cpp | 20 | ||||
-rw-r--r-- | pbap/pbap.cpp | 10 | ||||
-rw-r--r-- | telephony/telephony.cpp | 8 | ||||
-rw-r--r-- | weather/weather.cpp | 4 |
7 files changed, 31 insertions, 32 deletions
diff --git a/bluetooth/bluetooth.cpp b/bluetooth/bluetooth.cpp index cc5f496..d205e7d 100644 --- a/bluetooth/bluetooth.cpp +++ b/bluetooth/bluetooth.cpp @@ -48,7 +48,7 @@ void Bluetooth::generic_command(QString verb, QString value) tmsg->createRequest(verb, parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Bluetooth::setPower(bool state) @@ -74,7 +74,7 @@ void Bluetooth::setDiscoverable(bool state) tmsg->createRequest("set_property", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } m_discoverable = state; @@ -119,7 +119,7 @@ void Bluetooth::connect(QString address, QString uuid) parameter.insert("uuid", uuid); tmsg->createRequest("connect", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Bluetooth::connect(QString address) @@ -138,7 +138,7 @@ void Bluetooth::disconnect(QString address, QString uuid) parameter.insert("uuid", uuid); tmsg->createRequest("disconnect", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Bluetooth::disconnect(QString address) @@ -160,7 +160,7 @@ void Bluetooth::set_avrcp_controls(QString address, QString cmd) parameter.insert("value", cmd); tmsg->createRequest("set_avrcp_controls", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Bluetooth::onConnected() @@ -174,7 +174,7 @@ void Bluetooth::onConnected() parameter.insert("value", eventIterator.next()); tmsg->createRequest("subscribe", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } // get initial power state @@ -195,7 +195,7 @@ void Bluetooth::onDisconnected() parameter.insert("value", eventIterator.next()); tmsg->createRequest("unsubscribe", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } } diff --git a/mediaplayer/mediaplayer.cpp b/mediaplayer/mediaplayer.cpp index 384badf..bf0b4bc 100644 --- a/mediaplayer/mediaplayer.cpp +++ b/mediaplayer/mediaplayer.cpp @@ -76,7 +76,7 @@ void Mediaplayer::control(QString control, QJsonObject parameter) tmsg->createRequest("controls", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } @@ -166,7 +166,7 @@ void Mediaplayer::onConnected() parameter.insert("value", eventIterator.next()); tmsg->createRequest("subscribe", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } } @@ -181,7 +181,7 @@ void Mediaplayer::onDisconnected() parameter.insert("value", eventIterator.next()); tmsg->createRequest("unsubscribe", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } } diff --git a/messageengine.cpp b/messageengine.cpp index f090e27..c82670b 100644 --- a/messageengine.cpp +++ b/messageengine.cpp @@ -75,7 +75,6 @@ void MessageEngine::onConnected() void MessageEngine::onDisconnected() { disconnect(&m_websocket, &QWebSocket::textMessageReceived, this, &MessageEngine::onTextMessageReceived); - m_websocket.deleteLater(); emit disconnected(); } diff --git a/network/network.cpp b/network/network.cpp index 7bcf6d0..db4b2b4 100644 --- a/network/network.cpp +++ b/network/network.cpp @@ -60,7 +60,7 @@ void Network::connect(QString service) nmsg->createRequest("connect_service", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } void Network::disconnect(QString service) @@ -72,7 +72,7 @@ void Network::disconnect(QString service) nmsg->createRequest("disconnect_service", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } void Network::input(int id, QString passphrase) @@ -86,7 +86,7 @@ void Network::input(int id, QString passphrase) nmsg->createRequest("agent_response", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } void Network::power(bool on) @@ -106,7 +106,7 @@ void Network::enableTechnology(QString type) nmsg->createRequest("enable_technology", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } void Network::disableTechnology(QString type) @@ -118,7 +118,7 @@ void Network::disableTechnology(QString type) nmsg->createRequest("disable_technology", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } void Network::scanServices(QString type) @@ -130,7 +130,7 @@ void Network::scanServices(QString type) nmsg->createRequest("scan_services", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } bool Network::addService(QJsonObject service) @@ -189,7 +189,7 @@ void Network::getServices() nmsg->createRequest("services", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } void Network::updateWifiStatus(QJsonObject properties) @@ -235,7 +235,7 @@ void Network::getTechnologies() nmsg->createRequest("technologies", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } void Network::updateServiceProperties(QJsonObject data) @@ -311,7 +311,7 @@ void Network::onConnected() parameter.insert("value", eventIterator.next()); nmsg->createRequest("subscribe", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } getTechnologies(); @@ -328,7 +328,7 @@ void Network::onDisconnected() parameter.insert("value", eventIterator.next()); nmsg->createRequest("unsubscribe", parameter); m_mloop->sendMessage(nmsg); - nmsg->deleteLater(); + delete nmsg; } m_wifi->removeAllNetworks(); diff --git a/pbap/pbap.cpp b/pbap/pbap.cpp index 98c05b5..71dc7cb 100644 --- a/pbap/pbap.cpp +++ b/pbap/pbap.cpp @@ -108,7 +108,7 @@ void Pbap::refreshContacts(int max_entries) tmsg->createRequest("contacts", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Pbap::refreshCalls(int max_entries) @@ -122,7 +122,7 @@ void Pbap::refreshCalls(int max_entries) tmsg->createRequest("history", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Pbap::search(QString number) @@ -136,7 +136,7 @@ void Pbap::search(QString number) tmsg->createRequest("search", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } bool compareContactPtr(QObject *a, QObject *b) @@ -269,7 +269,7 @@ void Pbap::onConnected() parameter.insert("value", eventIterator.next()); tmsg->createRequest("subscribe", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } } @@ -284,7 +284,7 @@ void Pbap::onDisconnected() parameter.insert("value", eventIterator.next()); tmsg->createRequest("unsubscribe", parameter); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } } diff --git a/telephony/telephony.cpp b/telephony/telephony.cpp index 7f6a571..08b80b1 100644 --- a/telephony/telephony.cpp +++ b/telephony/telephony.cpp @@ -41,7 +41,7 @@ void Telephony::dial(QString number) TelephonyMessage *tmsg = new TelephonyMessage(); tmsg->createRequest("dial", number); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Telephony::answer() @@ -49,7 +49,7 @@ void Telephony::answer() TelephonyMessage *tmsg = new TelephonyMessage(); tmsg->createRequest("answer"); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Telephony::hangup() @@ -57,7 +57,7 @@ void Telephony::hangup() TelephonyMessage *tmsg = new TelephonyMessage(); tmsg->createRequest("hangup"); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Telephony::onConnected() @@ -74,7 +74,7 @@ void Telephony::onConnected() tmsg = new TelephonyMessage(); tmsg->createRequest("subscribe", eventIterator.next()); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } setConnected(true); diff --git a/weather/weather.cpp b/weather/weather.cpp index a4edb2a..c77e742 100644 --- a/weather/weather.cpp +++ b/weather/weather.cpp @@ -39,7 +39,7 @@ void Weather::onConnected() WeatherMessage *tmsg = new WeatherMessage(); tmsg->createRequest("subscribe", "weather"); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Weather::onDisconnected() @@ -47,7 +47,7 @@ void Weather::onDisconnected() WeatherMessage *tmsg = new WeatherMessage(); tmsg->createRequest("unsubscribe", "weather"); m_mloop->sendMessage(tmsg); - tmsg->deleteLater(); + delete tmsg; } void Weather::onMessageReceived(MessageType type, Message *message) |