{"record":{"id":"a569ed0972fd6af6","repo":"NationalSecurityAgency/ghidra","slug":"given-platform-has-been-deleted","errorCode":null,"errorMessage":"Given platform has been deleted","messagePattern":"Given platform has been deleted","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTracePlatformManager.java","lineNumber":383,"sourceCode":"\t@Override\n\tpublic Collection<TraceGuestPlatform> getGuestPlatforms() {\n\t\treturn platformView;\n\t}\n\n\t@Internal\n\tpublic InternalTracePlatform assertMine(TracePlatform platform) {\n\t\tif (platform == hostPlatform) {\n\t\t\treturn hostPlatform;\n\t\t}\n\t\tif (!(platform instanceof DBTraceGuestPlatform)) {\n\t\t\tthrow new IllegalArgumentException(\"Given platform does not belong to this trace\");\n\t\t}\n\t\tDBTraceGuestPlatform dbPlatform = (DBTraceGuestPlatform) platform;\n\t\tif (dbPlatform.manager != this) {\n\t\t\tthrow new IllegalArgumentException(\"Given platform does not belong to this trace\");\n\t\t}\n\t\tif (dbPlatform.isDeleted()) {\n\t\t\tthrow new IllegalArgumentException(\"Given platform has been deleted\");\n\t\t}\n\t\treturn dbPlatform;\n\t}\n\n\tprotected Address computeNextRegisterMin() {\n\t\tAddressRange hostRegsRange = hostPlatform.getRegistersRange();\n\t\tAddress next = hostRegsRange == null\n\t\t\t\t? hostPlatform.getAddressFactory().getRegisterSpace().getAddress(0)\n\t\t\t\t: hostRegsRange.getMaxAddress().add(1);\n\t\tfor (DBTraceGuestPlatform guest : platformStore.asMap().values()) {\n\t\t\tAddress candidateNext = guest.computeNextRegisterMin();\n\t\t\tif (candidateNext != null && next.compareTo(candidateNext) < 0) {\n\t\t\t\tnext = candidateNext;\n\t\t\t}\n\t\t}\n\t\treturn next;\n\t}\n}","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTracePlatformManager.java#L365-L401","documentation":"After the manager-identity check, assertMine tests dbPlatform.isDeleted(); if true it throws IllegalArgumentException(\"Given platform has been deleted\"). The platform row was removed (via deleteGuestPlatform) but a stale reference is still being used.","triggerScenarios":"Using a TraceGuestPlatform handle after deleteGuestPlatform was called on it; UI components or caches still holding the reference after deletion.","commonSituations":"Emulation or views retaining platform refs past a PLATFORM_DELETED event; delete-then-use sequences; caches not invalidated on deletion.","solutions":["Discard platform references on PLATFORM_DELETED change events.","Check platform.isDeleted() (liveness) before calling manager APIs.","Re-fetch the platform from the manager; a deleted one will no longer resolve."],"exampleFix":"// before\nmgr.someOp(stalePlatform);\n\n// after\nif (((DBTraceGuestPlatform) stalePlatform).isDeleted()) {\n    return; // or re-resolve\n}\nmgr.someOp(stalePlatform);","handlingStrategy":"validation","validationCode":"if (((DBTraceGuestPlatform) platform).isDeleted()) {\n    // discard reference; do not call manager APIs on it\n}","typeGuard":"static boolean isLivePlatform(TracePlatform p) {\n    return !(p instanceof DBTraceGuestPlatform g && g.isDeleted());\n}","tryCatchPattern":null,"preventionTips":["Listen for PLATFORM_DELETED events and clear cached references.","Check isDeleted() before invoking platform APIs.","Re-fetch platforms from the manager rather than caching long-term."],"tags":["platform","lifecycle","stale-reference"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}