Migrate built-in classes and interfaces to native C
Build / AerScript (push) Successful in 16s

This commit is contained in:
2026-11-19 16:15:05 +01:00
parent 58f604aea5
commit bcfa4c6163
8 changed files with 574 additions and 174 deletions
+10 -4
View File
@@ -3606,10 +3606,16 @@ static int PH7_builtin_closedir(ph7_context *pCtx, int nArg, ph7_value **apArg)
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Perform the requested operation */
pStream->xCloseDir(pDev->pHandle);
/* Release the private stucture */
ReleaseIOPrivate(pCtx, pDev);
/* Resources are copied raw pointers. Keep a directory-only tombstone until
* VM backend release, so stale aliases cannot dereference freed storage or
* close a newly opened handle at the same address. Invalidate before the
* device callback, which may re-enter the VM. One tiny wrapper per successful
* open is retained; the OS handle and buffer are released immediately. */
void *pHandle = pDev->pHandle;
pDev->iMagic = 0x2126;
pDev->pHandle = 0;
SyBlobRelease(&pDev->sBuffer);
pStream->xCloseDir(pHandle);
PH7_MemObjRelease(apArg[0]);
return PH7_OK;
}