From: Matthew Khouzam Date: Wed, 16 Sep 2015 20:49:37 +0000 (-0400) Subject: GDB: No longer synchronize on a string. X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=396a504f6dd28cac64436e37c0aa8888591e10f0;p=deliverable%2Ftracecompass.git GDB: No longer synchronize on a string. This is dangerous for two reasons: 1- if the string value changes, the object changes too, so we can corrupt data. 2- if the string is internalized, it can cause unwanted delays with other objects synchronizing coincidentally on the same string. Change-Id: Ibfeb3702ef82424b2fca86956f8227b52ae8b945 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/56133 Reviewed-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- diff --git a/gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java b/gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java index 5512b20a71..a29855f6f1 100644 --- a/gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java +++ b/gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java @@ -116,6 +116,8 @@ import org.eclipse.ui.ide.IDE; @SuppressWarnings("restriction") public class DsfGdbAdaptor { + private static final Object SESSION_LOCK = new Object(); + private GdbTrace fGdbTrace; private int fNumberOfFrames = 0; @@ -203,13 +205,13 @@ public class DsfGdbAdaptor { IDMContext context = (IDMContext) contextObject; if (context != null) { String sessionId; - synchronized(fCurrentSessionId) { + synchronized(SESSION_LOCK) { sessionId = context.getSessionId(); if (sessionId.equals(fCurrentSessionId)) { return; } + fCurrentSessionId = sessionId; } - fCurrentSessionId = sessionId; // Get the current trace record final DsfExecutor executor = DsfSession.getSession(sessionId).getExecutor(); final DsfServicesTracker tracker = new DsfServicesTracker(GdbTraceCorePlugin.getBundleContext(), sessionId);