From 4c8af8c17f7fefc02743c6606339df4efb46b4e7 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 7 Feb 2014 12:15:04 +0100 Subject: [PATCH] Don't use manager's constructor in connectionCreated This could cause duplicate managers. Use getInstanceFor() instead. SMACK-403. --- .../source/org/jivesoftware/smackx/carbons/CarbonManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/experimental/source/org/jivesoftware/smackx/carbons/CarbonManager.java b/experimental/source/org/jivesoftware/smackx/carbons/CarbonManager.java index 9217860ce..bdc00a31e 100644 --- a/experimental/source/org/jivesoftware/smackx/carbons/CarbonManager.java +++ b/experimental/source/org/jivesoftware/smackx/carbons/CarbonManager.java @@ -51,7 +51,7 @@ public class CarbonManager { static { Connection.addConnectionCreationListener(new ConnectionCreationListener() { public void connectionCreated(Connection connection) { - new CarbonManager(connection); + getInstanceFor(connection); } }); } @@ -73,7 +73,7 @@ public class CarbonManager { * * @return a CarbonManager instance */ - public static CarbonManager getInstanceFor(Connection connection) { + public static synchronized CarbonManager getInstanceFor(Connection connection) { CarbonManager carbonManager = instances.get(connection); if (carbonManager == null) {