--- loginDialog.js.orig	2014-06-02 15:33:05.000000000 +0200
+++ loginDialog.js	2014-06-13 23:27:34.372377733 +0200
@@ -469,6 +469,10 @@
                                    { expand: false,
                                      x_align: St.Align.START,
                                      x_fill: true });
+        this._nextSignalId = 0;
+        this._realmManager = new Realmd.Manager();
+        this._realmSignalId = this._realmManager.connect('login-format-changed',
+                                             Lang.bind(this, this._showRealmLoginHint));
 
         this._logoBin = new St.Widget({ style_class: 'login-dialog-logo-bin',
                                         x_align: Clutter.ActorAlign.CENTER,
@@ -626,14 +630,14 @@
         this._authPrompt.setPasswordChar('');
         this._authPrompt.setQuestion(_("Username: "));
 
-        let realmManager = new Realmd.Manager();
-        let realmSignalId = realmManager.connect('login-format-changed',
-                                                 Lang.bind(this, this._showRealmLoginHint));
-        this._showRealmLoginHint(realmManager.loginFormat);
+        this._showRealmLoginHint(this._realmManager.loginFormat);
 
-        let nextSignalId = this._authPrompt.connect('next',
+        if (this._nextSignalId)
+                this._authPrompt.disconnect(this._nextSignalId);
+        this._nextSignalId = this._authPrompt.connect('next',
                                                     Lang.bind(this, function() {
-                                                        this._authPrompt.disconnect(nextSignalId);
+                                                        this._authPrompt.disconnect(this._nextSignalId);
+                                                        this._nextSignalId = 0;
                                                         this._authPrompt.updateSensitivity(false);
                                                         let answer = this._authPrompt.getAnswer();
                                                         this._user = this._userManager.get_user(answer);
@@ -641,9 +645,6 @@
                                                         this._authPrompt.startSpinning();
                                                         this._authPrompt.begin({ userName: answer });
                                                         this._updateCancelButton();
-
-                                                        realmManager.disconnect(realmSignalId)
-                                                        realmManager.release();
                                                     }));
         this._updateCancelButton();
         this._showPrompt();
@@ -864,6 +865,11 @@
             this._userManager.disconnect(this._userManagerLoadedId);
             this._userManagerLoadedId = 0;
         }
+        if (this._realmManager) {
+            this._realmManager.disconnect(this._realmSignalId);
+            this._realmSignalId = 0;
+            this._realmManager.release();
+        }
     },
 
     _loadUserList: function() {
