mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 437525: NPE in QMakeProjectInfoManager
This fixes the NPE but not the underlying reason for the Qt plugin to be activated. I think that might be happening because of the Codan checker -- from what I recall, that extension point doesn't have a way to prevent plugin activation. The NPE is fixed by checking CACHE for null before using it. The #stop method unregisters and sets CACHE to null. However, unregistering doesn't prevent notifications that are already in flight. I suspect that notification arrives, and then CACHE is null. My test workspace would throw the NPE on every exit, with this change it never does. Change-Id: I01360a4c19c85fba53269d265948daf6d083c8d1 Signed-off-by: Andrew Eidsness <eclipse@jfront.com> Reviewed-on: https://git.eclipse.org/r/28751 Tested-by: Hudson CI Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
parent
bb3fd559c9
commit
da09460352
1 changed files with 15 additions and 0 deletions
|
@ -79,6 +79,11 @@ public class QMakeProjectInfoManager {
|
||||||
private static QMakeProjectInfo getQMakeProjectInfoFor(IProject project, boolean create) {
|
private static QMakeProjectInfo getQMakeProjectInfoFor(IProject project, boolean create) {
|
||||||
QMakeProjectInfo info;
|
QMakeProjectInfo info;
|
||||||
synchronized (CACHE_SYNC) {
|
synchronized (CACHE_SYNC) {
|
||||||
|
// If the cache is null then this must be a late notification after shutdown. We
|
||||||
|
// can't do anything so don't try.
|
||||||
|
if (CACHE == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
info = CACHE.get(project);
|
info = CACHE.get(project);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
return info;
|
return info;
|
||||||
|
@ -98,6 +103,11 @@ public class QMakeProjectInfoManager {
|
||||||
private static void removeProjectFromCache(IResource project) {
|
private static void removeProjectFromCache(IResource project) {
|
||||||
QMakeProjectInfo info;
|
QMakeProjectInfo info;
|
||||||
synchronized (CACHE_SYNC) {
|
synchronized (CACHE_SYNC) {
|
||||||
|
// If the cache is null then this must be a late notification after shutdown. We
|
||||||
|
// can't do anything so don't try.
|
||||||
|
if (CACHE == null)
|
||||||
|
return;
|
||||||
|
|
||||||
info = CACHE.remove(project);
|
info = CACHE.remove(project);
|
||||||
}
|
}
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
|
@ -213,6 +223,11 @@ public class QMakeProjectInfoManager {
|
||||||
|
|
||||||
List<QMakeProjectInfo> infos;
|
List<QMakeProjectInfo> infos;
|
||||||
synchronized (CACHE_SYNC) {
|
synchronized (CACHE_SYNC) {
|
||||||
|
// If the cache is null then this must be a late notification after shutdown. We
|
||||||
|
// can't do anything so don't try.
|
||||||
|
if (CACHE == null)
|
||||||
|
return;
|
||||||
|
|
||||||
infos = new ArrayList<QMakeProjectInfo>(CACHE.values());
|
infos = new ArrayList<QMakeProjectInfo>(CACHE.values());
|
||||||
}
|
}
|
||||||
for (QMakeProjectInfo info : infos) {
|
for (QMakeProjectInfo info : infos) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue