-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from SourcePointUSA/DIA-3423-DIA-3349-crashes
DIA-3423 DIA-3349 fix the crashes
- Loading branch information
Showing
7 changed files
with
69 additions
and
41 deletions.
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
Assets/ConsentManagementProvider/Scripts/observer/BroadcastEventDispatcher.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Concurrent; | ||
using ConsentManagementProviderLib.EventHandlerInterface; | ||
using UnityEngine.EventSystems; | ||
|
||
namespace ConsentManagementProviderLib.Observer | ||
{ | ||
internal static class BroadcastEventDispatcher | ||
{ | ||
public static Queue<Action> actions = new Queue<Action>(); | ||
public static ConcurrentQueue<Action> actions = new ConcurrentQueue<Action>(); | ||
|
||
public static void Execute<T>(BaseEventData eventData, ExecuteEvents.EventFunction<T> functor) where T : IConsentEventHandler | ||
{ | ||
var handlers = BroadcastReceivers.GetHandlersForEvent<T>(); | ||
if (handlers == null) return; | ||
CmpDebugUtil.Log($"{typeof(T).Name} has {handlers.Count} invokable instances"); | ||
CmpDebugUtil.Log($"{typeof(T).Name} has {handlers.Length} invokable instances"); | ||
foreach (var handler in handlers) | ||
{ | ||
actions.Enqueue(delegate { ExecuteEvents.Execute<T>(handler, eventData, functor); }); | ||
} | ||
} | ||
|
||
public static void Execute(Action action) | ||
{ | ||
actions.Enqueue(action); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.