MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / driver_destruct

Function driver_destruct

TactilityKernel/source/driver.cpp:43–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43error_t driver_destruct(Driver* driver) {
44 auto* internal = driver->internal;
45
46 if (driver->owner == nullptr) {
47 return ERROR_NOT_ALLOWED;
48 }
49 if (internal->use_count != 0 || internal->destroying) {
50 return ERROR_INVALID_STATE;
51 }
52 internal->destroying = true;
53
54 // Nullify internal reference before deletion to prevent use-after-free
55 driver->internal = nullptr;
56 delete internal;
57
58 return ERROR_NONE;
59}
60
61error_t driver_add(Driver* driver) {
62 LOG_I(TAG, "add %s", driver->name);

Callers 2

DriverTest.cppFile · 0.85
driver_remove_destructFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected