It seems that the function clearCurrentQuotaObject requires a pause in executing script or the ending of a function to work correctly (after its first call).
For example, this doesn't work correctly:
function testQuotas()
{
%quota = getQuotaObjectFromClient(localClientConnection);
setCurrentQuotaObject(%quota);
clearCurrentQuotaObject();
echo(getCurrentQuotaObject()); // echoes 0
setCurrentQuotaObject(%quota);
clearCurrentQuotaObject();
echo(getCurrentQuotaObject()); // echoes %quota (clearCurrentQuotaObject hasn't worked)
}
Whereas this does work (all the same but an extra nested function):
function clearQuota()
{
clearCurrentQuotaObject();
}
function testQuotas()
{
%quota = getQuotaObjectFromClient(localClientConnection);
setCurrentQuotaObject(%quota);
clearQuota();
echo(getCurrentQuotaObject()); // echoes 0
setCurrentQuotaObject(%quota);
clearQuota();
echo(getCurrentQuotaObject()); // echoes 0
}
And this also works:
function testQuotas()
{
testQuotasOnce(); // echoes 0
testQuotasOnce(); // echoes 0
}
function testQuotasOnce()
{
%quota = getQuotaObjectFromClient(localClientConnection);
setCurrentQuotaObject(%quota);
clearCurrentQuotaObject();
echo(getCurrentQuotaObject());
}
Also, between the time that a named brick is deleted and fxDtsBrick::onRemove is called, it's possible to spawn lights on it though events.