After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 745499 - Complete mission control activation
Complete mission control activation
Status: RESOLVED FIXED
Product: polari
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Polari maintainers
Polari maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-03 07:46 UTC by Giovanni Campagna
Modified: 2015-03-05 09:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
data: be consistent between filters and code (1.20 KB, patch)
2015-03-03 07:46 UTC, Giovanni Campagna
committed Details | Review
Wait until activated to restore channels (2.35 KB, patch)
2015-03-03 07:46 UTC, Giovanni Campagna
none Details | Review
Wait until activated to restore channels (2.96 KB, patch)
2015-03-03 22:32 UTC, Giovanni Campagna
none Details | Review
Wait until activated to restore channels (2.50 KB, patch)
2015-03-04 02:53 UTC, Giovanni Campagna
none Details | Review
Wait until activated to restore channels (2.88 KB, patch)
2015-03-05 04:00 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2015-03-03 07:46:18 UTC
I found the problem that resulted in missing channels when
activated by mission control.
Comment 1 Giovanni Campagna 2015-03-03 07:46:20 UTC
Created attachment 298370 [details] [review]
data: be consistent between filters and code

When adding the data file I didn't consider that the code
already has filters, so let's be consistent, otherwise
mission-control gets confused. We don't handle channels
with unknown handle type anyway.
Comment 2 Giovanni Campagna 2015-03-03 07:46:23 UTC
Created attachment 298371 [details] [review]
Wait until activated to restore channels

1) We don't want to restore channels when dbus started, if the
   app is not activated
2) Most importantly, we need an existing window or _ensureRoom fails
   misteriously.
   Previously this would work because it would do:
   startup -> activate -> mainloop -> account manager prepared
   -> ensureRoom -> (-> handle channels -> ensureRoom)
   but in the mission control activation the flow is
   startup -> mainloop -> account manager prepared -> handle channels ->
   ensureRoom -> activate

   We need the second ensureRoom to be effective, and to do so we
   must avoid an ineffective ensureRoom before we handle the channels.
Comment 3 Florian Müllner 2015-03-03 10:21:25 UTC
Review of attachment 298370 [details] [review]:

OK
Comment 4 Florian Müllner 2015-03-03 10:21:38 UTC
Review of attachment 298371 [details] [review]:

LGTM
Comment 5 Florian Müllner 2015-03-03 15:43:18 UTC
Review of attachment 298371 [details] [review]:

Sorry, didn't test properly - the patch has the tendency to wipe out the list of saved channels altogether
Comment 6 Florian Müllner 2015-03-03 19:42:22 UTC
OK, so I got a minute to look into this - the issue is that with the patch applied, "late" init may be called earlier now, *before* the account manager has been prepared ...
The following works, though I can't say I'm a huge fan of it:

-            this._chatroomManager.lateInit();
+            if (this._accountsMonitor.accountManager.is_prepared(null))
+                this._chatroomManager.lateInit();
+            else
+                this._accountsMonitor.connect('account-manager-prepared',
+                    Lang.bind(this, function() {
+                        this._chatroomManager.lateInit();
+                    }));
Comment 7 Giovanni Campagna 2015-03-03 22:32:26 UTC
Created attachment 298489 [details] [review]
Wait until activated to restore channels

1) We don't want to restore channels when dbus started, if the
   app is not activated
2) Most importantly, we need an existing window or _ensureRoom fails
   misteriously.
   Previously this would work because it would do:
   startup -> activate -> mainloop -> account manager prepared
   -> ensureRoom -> (-> handle channels -> ensureRoom)
   but in the mission control activation the flow is
   startup -> mainloop -> account manager prepared -> handle channels ->
   ensureRoom -> activate

   We need the second ensureRoom to be effective, and to do so we
   must avoid an ineffective ensureRoom before we handle the channels.

How about this one instead?
Comment 8 Florian Müllner 2015-03-03 22:55:04 UTC
Review of attachment 298489 [details] [review]:

Not sure, lots of state all over the place. How about sth like:

lateInit: function() {
    if (!this._accountsMonitor.accountManager.is_prepared(null) ||
        !this._app.get_active_window())
        return; // not ready yet!

    [...]
},

then call lateInit() from both places?
Comment 9 Giovanni Campagna 2015-03-04 02:53:14 UTC
Created attachment 298498 [details] [review]
Wait until activated to restore channels

1) We don't want to restore channels when dbus started, if the
   app is not activated
2) Most importantly, we need an existing window or _ensureRoom fails
   misteriously.
   Previously this would work because it would do:
   startup -> activate -> mainloop -> account manager prepared
   -> ensureRoom -> (-> handle channels -> ensureRoom)
   but in the mission control activation the flow is
   startup -> mainloop -> account manager prepared -> handle channels ->
   ensureRoom -> activate

   We need the second ensureRoom to be effective, and to do so we
   must avoid an ineffective ensureRoom before we handle the channels.
Comment 10 Florian Müllner 2015-03-04 09:01:59 UTC
Review of attachment 298498 [details] [review]:

::: src/chatroomManager.js
@@ +91,3 @@
+    lateInit: function() {
+        let am = this._accountsMonitor.accountManager;
+        let ready = am.is_prepared(null) &&

Sorry, I didn't actually check that this worked - apparently you do need to pass a valid feature quark like Tp.AccountManager.get_feature_quark_core() here (or do add a _amIsPrepared property)
Comment 11 Giovanni Campagna 2015-03-05 04:00:29 UTC
Created attachment 298599 [details] [review]
Wait until activated to restore channels

1) We don't want to restore channels when dbus started, if the
   app is not activated
2) Most importantly, we need an existing window or _ensureRoom fails
   misteriously.
   Previously this would work because it would do:
   startup -> activate -> mainloop -> account manager prepared
   -> ensureRoom -> (-> handle channels -> ensureRoom)
   but in the mission control activation the flow is
   startup -> mainloop -> account manager prepared -> handle channels ->
   ensureRoom -> activate

   We need the second ensureRoom to be effective, and to do so we
   must avoid an ineffective ensureRoom before we handle the channels.
Comment 12 Florian Müllner 2015-03-05 08:50:06 UTC
Review of attachment 298599 [details] [review]:

OK
Comment 13 Giovanni Campagna 2015-03-05 09:24:05 UTC
Attachment 298370 [details] pushed as 0b27b13 - data: be consistent between filters and code
Attachment 298599 [details] pushed as 8f8c685 - Wait until activated to restore channels