Skip to main content
summaryrefslogtreecommitdiffstats
path: root/qt
diff options
context:
space:
mode:
authorAndrew Eidsness2014-06-19 14:13:31 -0400
committerDoug Schaefer2014-07-07 10:23:45 -0400
commitda09460352afdea10658683cf429b9e3674c01ad (patch)
tree0001e9b6dc04652eeb0a359419b7537addf2ddfc /qt
parentbb3fd559c9d81b929adc4080b3bcab0f7781a77e (diff)
downloadorg.eclipse.cdt-da09460352afdea10658683cf429b9e3674c01ad.tar.gz
org.eclipse.cdt-da09460352afdea10658683cf429b9e3674c01ad.tar.xz
org.eclipse.cdt-da09460352afdea10658683cf429b9e3674c01ad.zip
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>
Diffstat (limited to 'qt')
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java
index 46e51b42e1..091f54abcb 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java
@@ -79,6 +79,11 @@ public class QMakeProjectInfoManager {
private static QMakeProjectInfo getQMakeProjectInfoFor(IProject project, boolean create) {
QMakeProjectInfo info;
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);
if (info != null) {
return info;
@@ -98,6 +103,11 @@ public class QMakeProjectInfoManager {
private static void removeProjectFromCache(IResource project) {
QMakeProjectInfo info;
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);
}
if (info != null) {
@@ -213,6 +223,11 @@ public class QMakeProjectInfoManager {
List<QMakeProjectInfo> infos;
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());
}
for (QMakeProjectInfo info : infos) {

Back to the top