-
The old code would leave a dangling pointer in oldstr_ptr if two threads attempted to take the same structure into the same location at the same time: 1. First "oldstr == newstr" check (before the loop) fails. 2. Compare-and-exchange fails, due to a second thread completing the same gst_structure_take. 3. Second "oldstr == newstr" check (in the loop) succeeds, loop breaks. 4. "oldstr" check succeeds, old structure gets freed. 5. oldstr_ptr now contains a dangling pointer. This shouldn't happen in code that handles ownership sanely, so check that we don't try to do this and complain loudly. Also simplify the function by using a do-while loop, like gst_mini_object_take. !413
a20ff6aa