Skip to content

Commit 249d8c2

Browse files
committed
Fix leaks of started and unstarted services #937
1 parent 2b7511a commit 249d8c2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ private void checkRunning() {
8080
@Override
8181
public void registerService(String serviceName, Object service) {
8282
checkRunning();
83-
agentServices.put(serviceName, service);
8483
if (service instanceof IAgentService) {
8584
((IAgentService) service).start();
8685
}
86+
if (agentServices.put(serviceName, service) instanceof IAgentService previous) {
87+
previous.stop();
88+
}
8789
}
8890

8991
public void setBundleContext(BundleContext context) {

0 commit comments

Comments
 (0)