summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-09-30 17:05:24 +0300
committerVaadin Code Review <review@vaadin.com>2015-10-05 10:17:07 +0000
commit743095d97bbd632e0493fca29ba2308b17b86716 (patch)
tree1b19d7b75d6f44ca880c5f585b7e629f60bdc9ac /server
parentb1c3580802400b039ecc57b15239792eaae0e3e7 (diff)
downloadvaadin-framework-743095d97bbd632e0493fca29ba2308b17b86716.tar.gz
vaadin-framework-743095d97bbd632e0493fca29ba2308b17b86716.zip
Properly cleanup stream variables if DragAndDropWrapper is detached (#14882)
If DragAndDropWrapper is removed from the UI for whatever reason before cleanup happens, the UI can no longer be found through it. If we do not do cleanup, we leave a reference hanging forever in ConnectorTracker. Change-Id: I9fc3da5d616276a7810ddc4a18cbebf8621635fe
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/communication/FileUploadHandler.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/server/src/com/vaadin/server/communication/FileUploadHandler.java b/server/src/com/vaadin/server/communication/FileUploadHandler.java
index 532c7fe95b..b9eaff3bd1 100644
--- a/server/src/com/vaadin/server/communication/FileUploadHandler.java
+++ b/server/src/com/vaadin/server/communication/FileUploadHandler.java
@@ -450,10 +450,13 @@ public class FileUploadHandler implements RequestHandler {
session.unlock();
}
try {
+ // Store ui reference so we can do cleanup even if connector is
+ // detached in some event handler
+ UI ui = connector.getUI();
boolean forgetVariable = streamToReceiver(session, inputStream,
streamVariable, filename, mimeType, contentLength);
if (forgetVariable) {
- cleanStreamVariable(session, connector, variableName);
+ cleanStreamVariable(session, ui, connector, variableName);
}
} catch (Exception e) {
session.lock();
@@ -684,15 +687,13 @@ public class FileUploadHandler implements RequestHandler {
out.close();
}
- private void cleanStreamVariable(VaadinSession session,
+ private void cleanStreamVariable(VaadinSession session, final UI ui,
final ClientConnector owner, final String variableName) {
session.accessSynchronously(new Runnable() {
@Override
public void run() {
- owner.getUI()
- .getConnectorTracker()
- .cleanStreamVariable(owner.getConnectorId(),
- variableName);
+ ui.getConnectorTracker().cleanStreamVariable(
+ owner.getConnectorId(), variableName);
}
});
}