mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
Bug 342791 - NPE in debug expression hover - null frame context
Patch by Kirk Beitz
This commit is contained in:
parent
db23381d3e
commit
536ce267ee
1 changed files with 30 additions and 22 deletions
|
@ -129,6 +129,10 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
|
||||||
@Override
|
@Override
|
||||||
protected String evaluateExpression(String expression) {
|
protected String evaluateExpression(String expression) {
|
||||||
IFrameDMContext frame = getFrame();
|
IFrameDMContext frame = getFrame();
|
||||||
|
if (frame == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String sessionId = frame.getSessionId();
|
String sessionId = frame.getSessionId();
|
||||||
DsfServicesTracker dsfServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), sessionId);
|
DsfServicesTracker dsfServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), sessionId);
|
||||||
try {
|
try {
|
||||||
|
@ -191,13 +195,13 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
|
||||||
public IInformationControlCreator getHoverControlCreator() {
|
public IInformationControlCreator getHoverControlCreator() {
|
||||||
if (useExpressionExplorer()) {
|
if (useExpressionExplorer()) {
|
||||||
return createExpressionInformationControlCreator();
|
return createExpressionInformationControlCreator();
|
||||||
} else {
|
|
||||||
return new IInformationControlCreator() {
|
|
||||||
public IInformationControl createInformationControl(Shell parent) {
|
|
||||||
return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new IInformationControlCreator() {
|
||||||
|
public IInformationControl createInformationControl(Shell parent) {
|
||||||
|
return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString());
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -214,25 +218,29 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
|
||||||
text= getExpressionText(textViewer, hoverRegion);
|
text= getExpressionText(textViewer, hoverRegion);
|
||||||
if (text != null && text.length() > 0) {
|
if (text != null && text.length() > 0) {
|
||||||
final IFrameDMContext frameDmc = getFrame();
|
final IFrameDMContext frameDmc = getFrame();
|
||||||
final DsfSession dsfSession = DsfSession.getSession(frameDmc.getSessionId());
|
if (frameDmc != null) {
|
||||||
Callable<IExpressionDMContext> callable = new Callable<IExpressionDMContext>() {
|
final DsfSession dsfSession = DsfSession.getSession(frameDmc.getSessionId());
|
||||||
public IExpressionDMContext call() throws Exception {
|
if (dsfSession != null) {
|
||||||
DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), frameDmc.getSessionId());
|
Callable<IExpressionDMContext> callable = new Callable<IExpressionDMContext>() {
|
||||||
try {
|
public IExpressionDMContext call() throws Exception {
|
||||||
IExpressions expressions = tracker.getService(IExpressions.class);
|
DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), frameDmc.getSessionId());
|
||||||
if (expressions != null) {
|
try {
|
||||||
return expressions.createExpression(frameDmc, text);
|
IExpressions expressions = tracker.getService(IExpressions.class);
|
||||||
|
if (expressions != null) {
|
||||||
|
return expressions.createExpression(frameDmc, text);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} finally {
|
||||||
|
tracker.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
};
|
||||||
} finally {
|
try {
|
||||||
tracker.dispose();
|
return dsfSession.getExecutor().submit(callable).get();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
} catch (ExecutionException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
try {
|
|
||||||
return dsfSession.getExecutor().submit(callable).get();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
} catch (ExecutionException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue