mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:57:36 +00:00
LibCore: Convert CNotifier to ObjectPtr
This commit is contained in:
parent
50a6560413
commit
d1bacb9885
17 changed files with 42 additions and 32 deletions
|
@ -56,7 +56,7 @@ void IRCClient::set_server(const String& hostname, int port)
|
|||
|
||||
void IRCClient::on_socket_connected()
|
||||
{
|
||||
m_notifier = make<CNotifier>(m_socket->fd(), CNotifier::Read);
|
||||
m_notifier = CNotifier::create(m_socket->fd(), CNotifier::Read);
|
||||
m_notifier->on_ready_to_read = [this] { receive_from_server(); };
|
||||
|
||||
send_user();
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
#include "IRCLogBuffer.h"
|
||||
#include "IRCWindow.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/CircularQueue.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/CConfigFile.h>
|
||||
#include <LibCore/CTCPSocket.h>
|
||||
#include <LibCore/ObjectPtr.h>
|
||||
|
||||
class IRCChannel;
|
||||
class IRCQuery;
|
||||
|
@ -18,6 +19,7 @@ class IRCClient final : public CObject {
|
|||
C_OBJECT(IRCClient)
|
||||
friend class IRCChannel;
|
||||
friend class IRCQuery;
|
||||
|
||||
public:
|
||||
IRCClient();
|
||||
virtual ~IRCClient() override;
|
||||
|
@ -138,7 +140,7 @@ private:
|
|||
CTCPSocket* m_socket { nullptr };
|
||||
|
||||
String m_nickname;
|
||||
OwnPtr<CNotifier> m_notifier;
|
||||
ObjectPtr<CNotifier> m_notifier;
|
||||
HashMap<String, RefPtr<IRCChannel>, CaseInsensitiveStringTraits> m_channels;
|
||||
HashMap<String, RefPtr<IRCQuery>, CaseInsensitiveStringTraits> m_queries;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
TerminalWidget::TerminalWidget(int ptm_fd, RefPtr<CConfigFile> config)
|
||||
: m_terminal(*this)
|
||||
, m_ptm_fd(ptm_fd)
|
||||
, m_notifier(ptm_fd, CNotifier::Read)
|
||||
, m_notifier(CNotifier::create(ptm_fd, CNotifier::Read))
|
||||
, m_config(move(config))
|
||||
{
|
||||
m_cursor_blink_timer = CTimer::create();
|
||||
|
@ -53,7 +53,7 @@ TerminalWidget::TerminalWidget(int ptm_fd, RefPtr<CConfigFile> config)
|
|||
else
|
||||
set_font(Font::load_from_file(font_entry));
|
||||
|
||||
m_notifier.on_ready_to_read = [this] {
|
||||
m_notifier->on_ready_to_read = [this] {
|
||||
u8 buffer[BUFSIZ];
|
||||
ssize_t nread = read(m_ptm_fd, buffer, sizeof(buffer));
|
||||
if (nread < 0) {
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
|
||||
bool m_in_active_window { false };
|
||||
|
||||
CNotifier m_notifier;
|
||||
ObjectPtr<CNotifier> m_notifier;
|
||||
|
||||
u8 m_opacity { 255 };
|
||||
bool m_needs_background_fill { true };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue