Code Error in StorageSettings.ExposeData()

Started by FuriouslyEloquent, May 30, 2018, 01:54:17 PM

Previous topic - Next topic

FuriouslyEloquent

Checked over Mantis, did not see this error. There is a subtle code error in the StorageSettings.ExposeData() method with the arguments to the ThingFilter's constructor.

In the StorageSettings() constructor, you see that the ThingFilter is created with a callback to TryNotifyChanged()
public StorageSettings()
{
this.filter = new ThingFilter(new Action(this.TryNotifyChanged));
}


But when the StorageSettings is serialized, it does not pass this callback to its ThingFilter.
public void ExposeData()
{
Scribe_Values.Look<StoragePriority>(ref this.priorityInt, "priority", StoragePriority.Unstored, false);
Scribe_Deep.Look<ThingFilter>(ref this.filter, "filter", new object[0]);
}


I discovered this error when I was attempted to wrap ThingFilter.settingsChangedCallback and I discovered that the original value was null once the StorageSettings had been re-loaded. I expect this is having certain very subtle effects, and it may be why it takes a few ticks after changing a zone's filter before it is fillable.
Someone should be cropping their images ... but I'm not

Tynan

#1
Looks like it's been taken care of, thanks.
Tynan Sylvester - @TynanSylvester - Tynan's Blog