diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-05-14 13:13:23 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-05-14 13:13:23 +1000 |
commit | 21c0682e3f98ee8afacff7be90828b05bc6ccb60 (patch) | |
tree | 5a256787d1080809f57aeb5fb295e03f8a426b8b /source/game | |
parent | a840f75d41be4765a476b1043b6a38f350d800e6 (diff) |
fix underflow on input clipboard allow state
Diffstat (limited to 'source/game')
-rw-r--r-- | source/game/StarInput.cpp | 5 | ||||
-rw-r--r-- | source/game/StarInput.hpp | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/source/game/StarInput.cpp b/source/game/StarInput.cpp index d47045d..dec6705 100644 --- a/source/game/StarInput.cpp +++ b/source/game/StarInput.cpp @@ -688,7 +688,10 @@ unsigned Input::getTag(String const& tagName) const { Input::ClipboardUnlock::ClipboardUnlock(Input& input) : m_input(&input) { ++m_input->m_clipboardAllowed; }; -Input::ClipboardUnlock::~ClipboardUnlock() { --m_input->m_clipboardAllowed; }; +Input::ClipboardUnlock::ClipboardUnlock(ClipboardUnlock&& other) { m_input = take(other.m_input); }; + +Input::ClipboardUnlock::~ClipboardUnlock() { if (m_input) --m_input->m_clipboardAllowed; }; + Input::ClipboardUnlock Input::unlockClipboard() { return Input::ClipboardUnlock(*this); diff --git a/source/game/StarInput.hpp b/source/game/StarInput.hpp index 1746739..05b20eb 100644 --- a/source/game/StarInput.hpp +++ b/source/game/StarInput.hpp @@ -184,6 +184,7 @@ public: class ClipboardUnlock { public: ClipboardUnlock(Input& input); + ClipboardUnlock(ClipboardUnlock&&); ~ClipboardUnlock(); private: |