mono / mono-addins

Mono.Addins is a generic framework for creating extensible applications, and for creating add-ins which extend those applications.
MIT License
163 stars 94 forks source link

Fix nested event dispatch issue #200

Closed slluis closed 1 year ago

slluis commented 1 year ago

Event handler invocations are done through a dispatch queue, to ensure that they are dispatched in the right order in multi-threading scenarios. The dispatch queue is also used when invoking a handler as a result of an event subscription. For example, when calling AddExtensionNodeHandler, the handler should be immediately invoked for all existing nodes in the provided extension path. However, if AddExtensionNodeHandler was invoked within an event handler, those invocations would be queued and not executed immediately as the caller would expect.

The solution is to do the handler invocation for existing nodes like it used to be, not through the queue. However, the actual event subscription still needs to be done through the queue, to avoid receiving unnecessary events. There is a more complete explanation in the code.

Therzok commented 1 year ago

@slluis this PR was closed without being merged?

slluis commented 1 year ago

Ugh, it looks like github automatically closed this PR when the one in vsmac was merged.