From 46fa017e1bafa1c23ac2f9702cbdd01bb1cedcaf Mon Sep 17 00:00:00 2001 From: Lee Venable Date: Tue, 11 Mar 2014 16:29:29 -0500 Subject: [PATCH] Issue #2865 - added more null and dispose checks Former-commit-id: df65d7c7ce57549b30475f5c456d69297e50c2dc [formerly c2aa1d021c49e522a3b4a9dd17a55317a13e91e1] Former-commit-id: 1f9d1af221ac165c1e2933235902e5300a1ddaff --- .../ui/session/AbstractSessionView.java | 10 +++++++--- .../ui/session/CollaborationSessionView.java | 12 ++++++++---- .../uf/viz/collaboration/ui/session/SessionView.java | 7 +++++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java index c03c07ee16..048c63e10b 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java @@ -90,7 +90,7 @@ import com.raytheon.viz.ui.views.CaveFloatingView; * Feb 24, 2014 2632 mpduff Moved sound generation code to CollaborationUtils * Mar 06, 2014 #2865 lvenable Fixed font memory leaks added SWT dispose checks when * running in an asynchronous thread. - * + * Mar 11, 2014 #2865 lvenable Added null checks for msgArchive. * * * @author rferrel @@ -446,7 +446,9 @@ public abstract class AbstractSessionView extends } // Archive the message - msgArchive.archive(sb.toString()); + if (msgArchive != null) { + msgArchive.archive(sb.toString()); + } // Append the text to the search control. if (searchComp.isDisposed() == false) { @@ -636,7 +638,9 @@ public abstract class AbstractSessionView extends } // Archive the message - msgArchive.archiveLine(builder.toString()); + if (msgArchive != null) { + msgArchive.archiveLine(builder.toString()); + } // Append the text to the search control. if (searchComp.isDisposed() == false) { diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java index 81d3b7c301..a784573306 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java @@ -98,6 +98,7 @@ import com.raytheon.viz.ui.input.EditableManager; * Feb 19, 2014 2751 bclement add change color and transfer leader icons * Mar 06, 2014 2751 bclement moved users table refresh logic to refreshParticipantList() * Mar 06, 2014 2848 bclement moved colormanager update code to session container + * Mar 11, 2014 #2865 lvenable Added null checks in threads * * * @@ -546,7 +547,9 @@ public class CollaborationSessionView extends SessionView implements VizApp.runAsync(new Runnable() { @Override public void run() { - usersTable.refresh(); + if (usersTable.getTable().isDisposed() == false) { + usersTable.refresh(); + } } }); } @@ -556,7 +559,9 @@ public class CollaborationSessionView extends SessionView implements VizApp.runAsync(new Runnable() { @Override public void run() { - usersTable.refresh(); + if (usersTable.getTable().isDisposed() == false) { + usersTable.refresh(); + } } }); } @@ -839,8 +844,7 @@ public class CollaborationSessionView extends SessionView implements VizApp.runAsync(new Runnable() { @Override public void run() { - if (usersTable != null - && !usersTable.getTable().isDisposed()) { + if (usersTable != null && !usersTable.getTable().isDisposed()) { refreshParticipantList(); } sendParticipantSystemMessage(event.getNewLeader(), diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java index b898fee458..4d14c05451 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java @@ -108,6 +108,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager; * to participantArrived. * Mar 06, 2014 2751 bclement moved users table refresh logic to refreshParticipantList() * Mar 06, 2014 2848 bclement get venueName directly from session + * Mar 11, 2014 #2865 lvenable Added null checks in threads * * * @@ -646,7 +647,9 @@ public class SessionView extends AbstractSessionView participantPresenceUpdated(participant, presence); break; case UPDATED: - usersTable.refresh(); + if (usersTable.getTable().isDisposed() == false) { + usersTable.refresh(); + } if (description != null) { sendParticipantSystemMessage(participant, description); } @@ -661,7 +664,7 @@ public class SessionView extends AbstractSessionView /** * get an updated list of participants from session and refresh usersTable */ - protected void refreshParticipantList(){ + protected void refreshParticipantList() { IVenue venue = session.getVenue(); Collection participants = venue.getParticipants(); if (session.isAdmin()) {