diff options
-rw-r--r-- | ridljar/com/sun/star/uno/UnoRuntime.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ridljar/com/sun/star/uno/UnoRuntime.java b/ridljar/com/sun/star/uno/UnoRuntime.java index 1cba9d8b0258..99da56aa9ea8 100644 --- a/ridljar/com/sun/star/uno/UnoRuntime.java +++ b/ridljar/com/sun/star/uno/UnoRuntime.java @@ -23,6 +23,8 @@ import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Iterator; +import java.util.UUID; +import java.util.WeakHashMap; import com.sun.star.lib.uno.typedesc.FieldDescription; import com.sun.star.lib.uno.typedesc.TypeDescription; @@ -106,7 +108,16 @@ public class UnoRuntime { if (object instanceof IQueryInterface) { oid = ((IQueryInterface) object).getOid(); } - return oid == null ? object.hashCode() + oidSuffix : oid; + if (oid == null) { + synchronized (oidMap) { + oid = oidMap.get(object); + if (oid == null) { + oid = UUID.randomUUID().toString() + oidSuffix; + oidMap.put(object, oid); + } + } + } + return oid; } /** @@ -690,6 +701,7 @@ public class UnoRuntime { private final IBridge bridge; } + private static final WeakHashMap<Object,String> oidMap = new WeakHashMap<Object,String>(); private static final String uniqueKeyHostPrefix = Integer.toString(new Object().hashCode(), 16) + ":"; private static final Object uniqueKeyLock = new Object(); |