-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π₯ Move away from the heresy of mixing unique_ptr with QObject.
ποΈ Also fix potential deadlock caused by how the memory ownership was managed
- Loading branch information
1 parent
a335b3b
commit d7ba869
Showing
9 changed files
with
95 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
#include <MySocket.hpp> | ||
#include <MySocket.hpp> | ||
|
||
std::unique_ptr<net::tcp::SocketWorker> MySocket::createWorker() | ||
net::tcp::SocketWorker* MySocket::createWorker() | ||
{ | ||
auto worker = std::make_unique<MySocketWorker>(); | ||
auto worker = new MySocketWorker; | ||
|
||
// Send string to worker | ||
connect(this, &MySocket::sendString, worker.get(), | ||
&MySocketWorker::onSendString); | ||
connect(this, &MySocket::sendErrorString, worker.get(), | ||
&MySocketWorker::onSendErrorString); | ||
connect(this, &MySocket::sendString, worker, &MySocketWorker::onSendString); | ||
connect(this, &MySocket::sendErrorString, worker, &MySocketWorker::onSendErrorString); | ||
|
||
// Receive string from worker | ||
connect(worker.get(), &MySocketWorker::stringAvailable, this, | ||
&MySocket::stringReceived); | ||
connect(worker, &MySocketWorker::stringAvailable, this, &MySocket::stringReceived); | ||
|
||
return std::move(worker); | ||
return worker; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.