LoginForm/LoginListener and getWindow()

Dear vaadin community

In order to support multiple tabs I’ve overwritten the getWindow() method, as suggested in this post:

It works fine for me, but the problem is now that the login event doesn’t fire (or it doesn’t arrive at the listener anymore), see the minimal code example below.
If the getWindow() method is commented out, it works without problems.

If this problem was already discussed in this forum I’m sorry, I didn’t find a thread related to this subject.
Are there any suggestions to solve this problem? I would really love to support multiple tabs and be able to login at the same time. Thanks already in advance.

public class LoginTestApplication extends Application implements LoginListener, ClickListener{
    private Window mainWindow,loginWindow;
    private  Button loginButton;
    public void init(){        
        mainWindow =  new Window("login test");
	loginWindow = new Window();
	LoginForm loginForm = new LoginForm();
	loginButton = new Button("login");

    public Window getWindow(String name) {
        Window w = super.getWindow(name);
	 if(w == null) {
	       w = new Window("test");
	       w.open(new ExternalResource(w.getURL()));
	  return w;

     public void onLogin(LoginEvent event) {

    public void buttonClick(ClickEvent event) {

Update: The problem seems to be that the LoginForm is contained in a subwindow. If it’s added directly to the main window, the listener gets the event. Any suggestions for solving this problem? I actually need the LoginForm in a subwindow (and the getWindow() method).