Codechange: Manage script event queue using smart pointers.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user