]> www.infradead.org Git - pidgin-chime.git/commitdiff
Fix media close
authorDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 14 Dec 2017 14:04:36 +0000 (14:04 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 31 Jan 2018 20:18:05 +0000 (20:18 +0000)
chat.c

diff --git a/chat.c b/chat.c
index a50b814e42f0a649ae65c96f29580947430be954..802f878be6943074842a64aa85ac2e59f7e9ac6c 100644 (file)
--- a/chat.c
+++ b/chat.c
@@ -250,8 +250,10 @@ static void call_media_changed(PurpleMedia *media, PurpleMediaState state, const
 {
 
        if (state == PURPLE_MEDIA_STATE_END && !id && !participant) {
-               chat->media = NULL;
-               chime_call_set_mute(chat->call, TRUE);
+               if (chat->media) {
+                       chat->media = NULL;
+                       chime_call_set_mute(chat->call, TRUE);
+               }
        }
 }
 
@@ -386,10 +388,11 @@ void chime_destroy_chat(struct chime_chat *chat)
                                                     0, 0, NULL, NULL, chat);
 
                if (chat->media) {
-                       purple_media_end(chat->media, "chime", chime_call_get_alert_body(chat->call));
-                       purple_media_manager_remove_media(purple_media_manager_get(),
-                                                         chat->media);
+                       PurpleMedia *media = chat->media;
                        chat->media = NULL;
+
+                       purple_media_end(media, "chime", chime_call_get_alert_body(chat->call));
+                       purple_media_manager_remove_media(purple_media_manager_get(), media);
                }
 
                if (chat->audio_inpipeline) {