mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 10:53:17 +00:00
PR feedback
This commit is contained in:
parent
f955a0ec5c
commit
ef97fbd222
@ -74,9 +74,11 @@ error_t device_destruct(Device* device) {
|
||||
auto* internal = device->internal;
|
||||
|
||||
if (internal->state.started || internal->state.added) {
|
||||
unlock_internal(device->internal);
|
||||
return ERROR_INVALID_STATE;
|
||||
}
|
||||
if (!internal->children.empty()) {
|
||||
unlock_internal(device->internal);
|
||||
return ERROR_INVALID_STATE;
|
||||
}
|
||||
LOG_D(TAG, "destruct %s", device->name);
|
||||
|
||||
@ -51,7 +51,7 @@ error_t driver_destruct(Driver* driver) {
|
||||
}
|
||||
internal->destroying = true;
|
||||
|
||||
// Remove the internal reference before unlocking so it cannot be accidentally locked again
|
||||
// Nullify internal reference before deletion to prevent use-after-free
|
||||
driver->internal = nullptr;
|
||||
delete internal;
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#include <vector>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
#include <new>
|
||||
#include <tactility/concurrent/mutex.h>
|
||||
#include <tactility/module.h>
|
||||
#include <new>
|
||||
#include <vector>
|
||||
|
||||
#define TAG "module"
|
||||
|
||||
@ -116,4 +116,3 @@ bool module_resolve_symbol_global(const char* symbol_name, uintptr_t* symbol_add
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user