Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2008-01-16 23:02:49 +0000
committerJohn Cortell2008-01-16 23:02:49 +0000
commit3dff3a9d293f8de8c9756f17a4831902c2067747 (patch)
treef6f2eb505e01d7aa481c46b9787d7758f164c3cc /debug/org.eclipse.cdt.debug.core
parent9fb1c6978973df8f55058f2a8900524be78cea0f (diff)
downloadorg.eclipse.cdt-3dff3a9d293f8de8c9756f17a4831902c2067747.tar.gz
org.eclipse.cdt-3dff3a9d293f8de8c9756f17a4831902c2067747.tar.xz
org.eclipse.cdt-3dff3a9d293f8de8c9756f17a4831902c2067747.zip
Plugged reference leak. When all breakpoints were removed from a debug session during session termination, the platform breakpoint objects were being left with a reference to the defunct CDebugTarget.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.core')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
index b6502936416..bf55c6deea2 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
@@ -28,6 +28,7 @@ import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation;
@@ -655,6 +656,23 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
final ICDIBreakpoint[] cdiBreakpoints = (ICDIBreakpoint[])installedCDIBplist.toArray( new ICDIBreakpoint[installedCDIBplist.size()] );
final ICDITarget cdiTarget = getCDITarget();
+ // Clean up the target filter to avoid that the CDebugTarget remains referenced by the breakpoint.
+ // Note that while we're "removing" breakpoints from a debug session, the breakpoint objects in the
+ // platform aren't going anywhere. They are "global" model elements. They go away only when the user
+ // deletes them.
+ CDebugTarget target = getDebugTarget();
+ for (Iterator iter = installedCBplist.iterator(); iter.hasNext();) {
+ ICBreakpoint breakpoint = (ICBreakpoint) iter.next();
+ if ( isFilteredByTarget( breakpoint, target ) ) {
+ try {
+ breakpoint.removeTargetFilter( target );
+ }
+ catch( CoreException e ) {
+ CDebugCorePlugin.log( e.getStatus() );
+ }
+ }
+ }
+
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try {

Back to the top