Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-addins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2022-10-27 13:26:14 +0300
committerLluis Sanchez <lluis@xamarin.com>2022-10-27 13:26:14 +0300
commitf86d50b03bf48a3b1bcb87eb9a26487c0ceaef04 (patch)
treeba98f50b0091f1d33bcb6a10e8deed43c4038ed2 /Mono.Addins
parent9eaab025099bc82c0fc31379afa95786aa7fcdfa (diff)
Fix NRE when unloading an add-in
When removing many nodes in a transaction it may happen that a parent is removed before its children, since the list of nodes to remove is in a hashset, so there is no defined order. Added a null check to avoid a crash when that happens.
Diffstat (limited to 'Mono.Addins')
-rw-r--r--Mono.Addins/Mono.Addins/ExtensionContextTransaction.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Mono.Addins/Mono.Addins/ExtensionContextTransaction.cs b/Mono.Addins/Mono.Addins/ExtensionContextTransaction.cs
index ba2a245..99cba20 100644
--- a/Mono.Addins/Mono.Addins/ExtensionContextTransaction.cs
+++ b/Mono.Addins/Mono.Addins/ExtensionContextTransaction.cs
@@ -165,7 +165,9 @@ namespace Mono.Addins
{
foreach (var node in childrenChanged)
{
- if (node.NotifyChildrenChanged())
+ // It may happen that a node is removed while updating its parent. In this case the parent
+ // will be set to null, and then there is no need to notify changes
+ if (node.Parent != null && node.NotifyChildrenChanged())
NotifyExtensionsChangedEvent(node.GetPath());
}
}