Skip to content

Commit 864c41b

Browse files
authored
prevent copying various ffi wrapper classes (#48195)
1 parent 1b8be54 commit 864c41b

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

src/core/eventloop.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ class EventLoop
3232
EventLoop(int capacity);
3333
~EventLoop();
3434

35+
// disable copying
36+
EventLoop(const EventLoop &) = delete;
37+
EventLoop & operator=(const EventLoop &) = delete;
38+
3539
std::optional<int> step();
3640
int exec();
3741
void exit(int code);

src/core/tcplistener.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class TcpListener
3131
TcpListener();
3232
~TcpListener();
3333

34+
// disable copying
35+
TcpListener(const TcpListener &) = delete;
36+
TcpListener & operator=(const TcpListener &) = delete;
37+
3438
bool bind(const QHostAddress &addr, uint16_t port);
3539
std::tuple<QHostAddress, uint16_t> localAddress() const;
3640
std::unique_ptr<TcpStream> accept();

src/core/tcpstream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ class TcpStream : public ReadWrite
3434
TcpStream();
3535
~TcpStream();
3636

37+
// disable copying
38+
TcpStream(const TcpStream &) = delete;
39+
TcpStream & operator=(const TcpStream &) = delete;
40+
3741
// returns true if connection starting, false on error
3842
bool connect(const QHostAddress &addr, uint16_t port);
3943

src/core/timerwheel.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class TimerWheel
4242
TimerWheel(int capacity);
4343
~TimerWheel();
4444

45+
// disable copying
46+
TimerWheel(const TimerWheel &) = delete;
47+
TimerWheel & operator=(const TimerWheel &) = delete;
48+
4549
// returns <0 if no capacity
4650
int add(quint64 expires, size_t userData);
4751

src/core/unixlistener.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class UnixListener
3131
UnixListener();
3232
~UnixListener();
3333

34+
// disable copying
35+
UnixListener(const UnixListener &) = delete;
36+
UnixListener & operator=(const UnixListener &) = delete;
37+
3438
bool bind(const QString &path);
3539
std::unique_ptr<UnixStream> accept();
3640
int errorCondition() const { return errorCondition_; }

src/core/unixstream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ class UnixStream : public ReadWrite
3232
UnixStream();
3333
~UnixStream();
3434

35+
// disable copying
36+
UnixStream(const UnixStream &) = delete;
37+
UnixStream & operator=(const UnixStream &) = delete;
38+
3539
// returns true if connection starting, false on error
3640
bool connect(const QString &path);
3741

0 commit comments

Comments
 (0)