Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possibly dangling pointer #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix possibly dangling pointer
Just wraps this in a QPointer so we're on the safe side if anyone
else has already deleted clientConnection.
msarehn committed Jun 23, 2023
commit ce9dfb7ed1ae07b3a531186724cd7a90016744b0
4 changes: 3 additions & 1 deletion maia/maiaXmlRpcServerConnection.cpp
Original file line number Diff line number Diff line change
@@ -37,7 +37,9 @@ MaiaXmlRpcServerConnection::MaiaXmlRpcServerConnection(QTcpSocket *connection, b
}

MaiaXmlRpcServerConnection::~MaiaXmlRpcServerConnection() {
clientConnection->deleteLater();
if (clientConnection) {
clientConnection->deleteLater();
}
delete header;
}

2 changes: 1 addition & 1 deletion maia/maiaXmlRpcServerConnection.h
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ class MaiaXmlRpcServerConnection : public QObject {
const QByteArray &method, const QList<QByteArray> argTypes);


QTcpSocket *clientConnection;
QPointer<QTcpSocket> clientConnection;
bool mAllowPersistentConnection;
QString headerString;
QHttpRequestHeader *header;