Codechange: Manage script event queue using smart pointers.

This commit is contained in:
frosch
2025-04-18 18:03:14 +02:00
committed by frosch
parent b9f4ef3d78
commit 0d4588688f
5 changed files with 32 additions and 56 deletions
+11 -3
View File
@@ -327,12 +327,12 @@ protected:
static bool CanSuspend();
/**
* Get the pointer to store event data in.
* Get the reference to the event queue.
*/
static void *&GetEventPointer();
static struct ScriptEventQueue &GetEventQueue();
/**
* Get the pointer to store log message in.
* Get the reference to the log message storage.
*/
static ScriptLogTypes::LogData &GetLogData();
@@ -467,6 +467,14 @@ public:
if (this->data != nullptr) this->data->Release();
}
/**
* Transfer ownership to the caller.
*/
[[nodiscard]] T *release()
{
return std::exchange(this->data, nullptr);
}
/**
* Dereferencing this reference returns a reference to the reference
* counted object