[polari/wip/fmuellner/warning-fixes: 2/6] chatView: Fix warning on shutdown



commit 1605f61a205a66f0eaf6487dc9f1164f3593de8e
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Dec 3 01:09:43 2018 +0100

    chatView: Fix warning on shutdown
    
    One reason for a nick status change is that we disconnect the account.
    If we also close the corresponding room at the same time (for example
    on shutdown), there's a good chance that the room's channel property
    is unset after we send the request to ack all pending messages, but
    before the operation's callback is called. Avoid accessing an undefined
    property in that case by using the callback parameter, which will still
    be alive under all circumstances at that point.
    
    https://gitlab.gnome.org/GNOME/polari/merge_requests/79

 src/chatView.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 9d782cd..d6c3b79 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -1304,8 +1304,8 @@ var ChatView = GObject.registerClass({
         if (this._room.type == Tp.HandleType.CONTACT &&
             status == Tp.ConnectionPresenceType.OFFLINE &&
             this._room.channel)
-            this._room.channel.ack_all_pending_messages_async(() => {
-                this._room.channel.close_async(null);
+            this._room.channel.ack_all_pending_messages_async(channel => {
+                channel.close_async(null);
             });
 
         let nickTagName = this._getNickTagName(baseNick);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]