Bug 1280443: Copy this the hard way. r=drno a=sylvestre
authorByron Campen [:bwc] <docfaraday@gmail.com>
Wed, 10 Aug 2016 11:51:28 -0500
changeset 407636 9bf4d2171f273c1543fa548b09dbe76311cd0b34
parent 407635 3b25a6cbf07032fff12ab8e04c5b8175aa07195f
child 407637 b66e4f53fe15662f88e05b9d48a6e3c521d376f7
push id28002
push userfelipc@gmail.com
push dateTue, 30 Aug 2016 18:14:28 +0000
reviewersdrno, sylvestre
bugs1280443
milestone48.0.1
Bug 1280443: Copy this the hard way. r=drno a=sylvestre
media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
--- a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
@@ -869,20 +869,27 @@ int nr_ice_media_stream_disable_componen
     return(_status);
   }
 
 void nr_ice_media_stream_role_change(nr_ice_media_stream *stream)
   {
     nr_ice_cand_pair *pair,*temp_pair;
     /* Changing role causes candidate pair priority to change, which requires
      * re-sorting the check list. */
-    nr_ice_cand_pair_head old_checklist=stream->check_list;
-    TAILQ_INIT(&stream->check_list);
+    nr_ice_cand_pair_head old_checklist;
 
     assert(stream->ice_state != NR_ICE_MEDIA_STREAM_UNPAIRED);
 
+    /* Move check_list to old_checklist (not POD, have to do the hard way) */
+    TAILQ_INIT(&old_checklist);
+    TAILQ_FOREACH_SAFE(pair,&stream->check_list,check_queue_entry,temp_pair) {
+      TAILQ_REMOVE(&stream->check_list,pair,check_queue_entry);
+      TAILQ_INSERT_TAIL(&old_checklist,pair,check_queue_entry);
+    }
+
+    /* Re-insert into the check list */
     TAILQ_FOREACH_SAFE(pair,&old_checklist,check_queue_entry,temp_pair) {
       TAILQ_REMOVE(&old_checklist,pair,check_queue_entry);
       nr_ice_candidate_pair_role_change(pair);
       nr_ice_candidate_pair_insert(&stream->check_list,pair);
     }
   }