]> source.dussan.org Git - vaadin-framework.git/commitdiff
Memory leak fix in ConnectorTracker (#10743)
authordoggy-dev <b369b7b2@opayq.com>
Tue, 17 Jul 2018 12:50:47 +0000 (14:50 +0200)
committerIlia Motornyi <elmot@vaadin.com>
Tue, 17 Jul 2018 12:50:47 +0000 (15:50 +0300)
When finished with upload, streamVariable should be disposed.
Now StreamVariable is removed also from streamVariableToSeckey.
https://github.com/vaadin/framework/issues/10695 #10695

server/src/main/java/com/vaadin/ui/ConnectorTracker.java
server/src/main/java/com/vaadin/ui/Upload.java

index 713d9b47c1feedbddfc19f65a4a104af059d96a2..8b8ba269cfc540bb1db304046921f8313e2d3c77 100644 (file)
@@ -846,7 +846,8 @@ public class ConnectorTracker implements Serializable {
         }
         Map<String, StreamVariable> nameToStreamVar = pidToNameToStreamVariable
                 .get(connectorId);
-        nameToStreamVar.remove(variableName);
+        StreamVariable streamVar = nameToStreamVar.remove(variableName);
+        streamVariableToSeckey.remove(streamVar);
         if (nameToStreamVar.isEmpty()) {
             pidToNameToStreamVariable.remove(connectorId);
         }
index 1a66842e3d4942d460fed0e5ee22f9f4eec35323..70f31f4957be88a60d1702123b3b0a84c90168d0 100644 (file)
@@ -1155,6 +1155,8 @@ public class Upload extends AbstractComponent
                     fireUploadSuccess(event.getFileName(), event.getMimeType(),
                             event.getContentLength());
                     endUpload();
+                    if(lastStartedEvent != null)
+                        lastStartedEvent.disposeStreamVariable();
                 }
 
                 @Override
@@ -1173,6 +1175,8 @@ public class Upload extends AbstractComponent
                         }
                     } finally {
                         endUpload();
+                        if(lastStartedEvent != null)
+                            lastStartedEvent.disposeStreamVariable();
                     }
                 }
             };