null reference exception when shutting down after fetching textures

Description

When exiting the application and disconnecting libomv, one gets a NullReferenceException. This was traced to the TexturePipeline unregistering an event. Looking at the code in EventDictionary.UnRegisterEvent, when the last event is removed from the callback, the callback goes to null making the reference to the GetInvocationList test throw an exception. The code in EventDictionary.UnRegisterEvent should read:

if (_EventTable.TryGetValue(packetType, out callback))
{
callback.Callback -= eventHandler;
if (callback.Callback == null || callback.Callback.GetInvocationList().Length == 0)
_EventTable.Remove(packetType);
}

which checks for the extra case of the callback being empty/null.

Steps to Reproduce

Initialize libomv, fetch some textures (thus using TexturePipeline) then perform disconnect.

Activity

Show:
Latif Khalifa
August 20, 2010, 5:59 AM

Change applied, thanks!

Assignee

Latif Khalifa

Reporter

Robert Adams

Severity

Medium

Environment

All

Fixed in Revision

None

Components

Fix versions

Affects versions

Priority

Major
Configure