Project

General

Profile

Revision 82f2be03

ID82f2be03e9aaaf1a1fe5da4a9798c0f05fa68c35
Parent fba774b1
Child c6b02b73

Added by Andreas Kohlbecker about 3 years ago

fix #7742 unsubscribing other beans from event bus on dispose()

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/distributionStatus/DistributionToolbar.java
4 4

  
5 5
import javax.annotation.PostConstruct;
6 6

  
7
import org.springframework.beans.factory.DisposableBean;
7 8
import org.springframework.beans.factory.annotation.Autowired;
8 9
import org.springframework.beans.factory.annotation.Qualifier;
9 10
import org.vaadin.spring.events.EventBus;
......
29 30
 */
30 31
@SpringComponent("distributionToolbar")
31 32
@ViewScope
32
public class DistributionToolbar extends HorizontalLayout implements Serializable{
33
public class DistributionToolbar extends HorizontalLayout implements Serializable, DisposableBean{
33 34

  
34 35
	/**
35 36
	 * automatically generated ID
......
41 42
    @Autowired
42 43
    private final void setViewEventBus(EventBus.UIEventBus viewEventBus){
43 44
        this.uiEventBus = viewEventBus;
44
        viewEventBus.subscribe(AuthenticationSuccessEvent.class);
45
        viewEventBus.subscribe(AuthenticationSuccessEvent.class); // FIXME shouldn't this be .subscribe(this) ??
45 46
    }
46 47

  
47 48
    @Autowired
......
220 221
	public Button getHelpButton() {
221 222
		return helpButton;
222 223
	}
224

  
225
    /**
226
     * {@inheritDoc}
227
     */
228
    @Override
229
    public void destroy() throws Exception {
230
        uiEventBus.unsubscribe(this);
231
    }
223 232
}
src/main/java/eu/etaxonomy/vaadin/ui/mainmenu/ValoMainMenuBean.java
5 5
import java.util.stream.Collectors;
6 6
import java.util.stream.StreamSupport;
7 7

  
8
import org.springframework.beans.factory.DisposableBean;
8 9
import org.springframework.beans.factory.annotation.Autowired;
9 10
import org.vaadin.spring.events.EventBus;
10 11
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
......
30 31

  
31 32
@SpringComponent
32 33
@UIScope
33
class ValoMainMenuBean extends CssLayout implements MainMenu {
34
class ValoMainMenuBean extends CssLayout implements MainMenu, DisposableBean {
34 35

  
35 36
	private static final long serialVersionUID = -993548217313748689L;
36 37

  
......
116 117
    public void addMenuComponent(Component component) {
117 118
        menuArea.addComponent(component);
118 119
    }
120

  
121
    /**
122
     * {@inheritDoc}
123
     */
124
    @Override
125
    public void destroy() throws Exception {
126
        uiEventBus.unsubscribe(this);
127
    }
119 128
}
src/main/java/eu/etaxonomy/vaadin/ui/navigation/NavigationManagerBean.java
282 282
    public void setViewDisplay(ViewDisplay viewDisplay){
283 283
        this.viewDisplay = viewDisplay;
284 284
    }
285

  
286
    /**
287
     * {@inheritDoc}
288
     */
289
    @Override
290
    public void destroy() {
291
        super.destroy();
292
        uiEventBus.unsubscribe(this);
293
    }
294

  
295

  
285 296
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)