LibCore: Convert CTCPSocket to ObjectPtr, add construct() helper

The C_OBJECT macro now also inserts a static construct(...) helper into
the class. Now we can make the constructor(s) private and instead call:

    auto socket = CTCPSocket::construct(arguments);

construct() returns an ObjectPtr<T>, which we'll later switch to being
a NonnullRefPtr<T>, once everything else in in place for ref-counting.
This commit is contained in:
Andreas Kling 2019-09-21 10:13:34 +02:00
commit 4298ba25c3
Notes: sideshowbarker 2024-07-19 12:02:41 +09:00
15 changed files with 30 additions and 25 deletions

View file

@ -116,7 +116,7 @@ void CHttpJob::finish_up()
void CHttpJob::start()
{
ASSERT(!m_socket);
m_socket = new CTCPSocket(this);
m_socket = CTCPSocket::construct(this);
m_socket->on_connected = [this] {
dbg() << "CHttpJob: on_connected callback";
on_socket_connected();