Skip to content

Commit 2b6505f

Browse files
yulian-gaponenkoiText-CI
authored andcommitted
Make EventData building based on IEvent synchronization independent from factory instance
Using factory instance for blocking is prone to sync issues. We don't document possibility to block on IEventDataFactory instance anyway. DEVSIX-5515 Autoported commit. Original commit hash: [82e91cf69]
1 parent d11d12e commit 2b6505f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

itext/itext.kernel/itext/kernel/counter/data/EventDataHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ namespace iText.Kernel.Counter.Data {
8181
/// <typeparam name="V">data type</typeparam>
8282
public abstract class EventDataHandler<T, V>
8383
where V : EventData<T> {
84+
private readonly Object createLock = new Object();
85+
8486
private readonly Object processLock = new Object();
8587

8688
private readonly IEventDataCache<T, V> cache;
@@ -110,8 +112,7 @@ public virtual IList<V> Clear() {
110112

111113
public virtual void Register(IEvent @event, IMetaInfo metaInfo) {
112114
V data;
113-
//Synchronization is left here mostly in consistency with cache and process, but factories are usually not thread safe anyway.
114-
lock (factory) {
115+
lock (createLock) {
115116
data = factory.Create(@event, metaInfo);
116117
}
117118
if (data != null) {

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
427b4ef12f5518f96006747f22ada788b9eb21a7
1+
82e91cf69ce5955d6e1f9360a4e5b0fecb16151b

0 commit comments

Comments
 (0)