I'm trying glib.Timeout for the first time, I have a delegate attached that returns false when a set of conditions is met. This all works fine, however I notice I get a warning when calling stop when the delegate returns false as follows:
Source ID XXX was not found when attempting to remove it
I'm thinking the method callAllListeners should set the timerID to 0 if all delegates are removed. I've tried this locally and it seems to resolve the problem:
private bool callAllListeners()
{
bool runAgain = false;
int i = 0;
while ( i<timeoutListeners.length )
{
if ( !timeoutListeners[i]() )
{
timeoutListeners = timeoutListeners[0..i] ~ timeoutListeners[i+1..timeoutListeners.length];
}
else
{
runAgain = true;
++i;
}
}
// GBN - Set timeoutID to 0 if all delegates are removed
if (timeoutListeners.length == 0) timeoutID = 0;
return runAgain;
}
The text was updated successfully, but these errors were encountered:
I'm trying glib.Timeout for the first time, I have a delegate attached that returns false when a set of conditions is met. This all works fine, however I notice I get a warning when calling stop when the delegate returns false as follows:
I'm thinking the method callAllListeners should set the timerID to 0 if all delegates are removed. I've tried this locally and it seems to resolve the problem:
The text was updated successfully, but these errors were encountered: