mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[309215] Missing guards against NPEs and against calling things after being disposed.
This commit is contained in:
parent
234a20224a
commit
17a3b5142f
1 changed files with 14 additions and 13 deletions
|
@ -111,15 +111,15 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISelectionListener fDebugViewListener = null;
|
private ISelectionListener fDebugViewListener;
|
||||||
private String fDebugSessionId = null;
|
private String fDebugSessionId;
|
||||||
private DsfServicesTracker fServicesTracker = null;
|
private DsfServicesTracker fServicesTracker;
|
||||||
private volatile ITraceTargetDMContext fTargetContext = null;
|
private volatile ITraceTargetDMContext fTargetContext;
|
||||||
|
|
||||||
private StyledText fStatusText = null;
|
private StyledText fStatusText;
|
||||||
protected Action fActionRefreshView = null;
|
protected Action fActionRefreshView;
|
||||||
protected Action fOpenTraceVarDetails = null;
|
protected Action fOpenTraceVarDetails;
|
||||||
private boolean fTracingSupported = false;
|
private boolean fTracingSupported;
|
||||||
|
|
||||||
public TraceControlView() {
|
public TraceControlView() {
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,8 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
getSite().getPage().removeSelectionListener(fDebugViewListener);
|
getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, fDebugViewListener);
|
||||||
|
fStatusText = null; // Indicate that we have been disposed
|
||||||
setDebugContext(null);
|
setDebugContext(null);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
@ -205,7 +206,7 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String retrieveStatus() {
|
protected String retrieveStatus() {
|
||||||
if (fDebugSessionId == null) {
|
if (fDebugSessionId == null || getSession() == null) {
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +305,7 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
|
||||||
// updateContent() will fix it
|
// updateContent() will fix it
|
||||||
fTracingSupported = false;
|
fTracingSupported = false;
|
||||||
|
|
||||||
if (fDebugSessionId != null) {
|
if (fDebugSessionId != null && getSession() != null) {
|
||||||
try {
|
try {
|
||||||
final DsfSession session = getSession();
|
final DsfSession session = getSession();
|
||||||
session.getExecutor().execute(new DsfRunnable() {
|
session.getExecutor().execute(new DsfRunnable() {
|
||||||
|
@ -402,7 +403,7 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
|
||||||
* @return null when the list cannot be obtained.
|
* @return null when the list cannot be obtained.
|
||||||
*/
|
*/
|
||||||
public ITraceVariableDMData[] getTraceVarList() {
|
public ITraceVariableDMData[] getTraceVarList() {
|
||||||
if (fDebugSessionId == null) {
|
if (fDebugSessionId == null || getSession() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +454,7 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
|
||||||
* will contain the error message to display to the user.
|
* will contain the error message to display to the user.
|
||||||
*/
|
*/
|
||||||
protected void createVariable(final String name, final String value) throws FailedTraceVariableCreationException {
|
protected void createVariable(final String name, final String value) throws FailedTraceVariableCreationException {
|
||||||
if (fDebugSessionId == null) {
|
if (fDebugSessionId == null || getSession() == null) {
|
||||||
throw new FailedTraceVariableCreationException(TracepointsMessages.TraceControlView_create_variable_error);
|
throw new FailedTraceVariableCreationException(TracepointsMessages.TraceControlView_create_variable_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue