#218 Fix for OpalMediaPatch::Close method

closed-accepted
nobody
Opal (88)
5
2012-11-15
2012-10-31
No

OpalMediaPatch::Close can cause PAssert on closing.

Here is a patch:

Index: opal/src/opal/patch.cxx

--- opal/src/opal/patch.cxx (revision 28421)
+++ opal/src/opal/patch.cxx (working copy)
@@ -170,7 +170,8 @@
while (sinks.GetSize() > 0) {
OpalMediaStreamPtr stream = sinks.front().stream;
UnlockReadWrite();
- if (!stream->Close()) {
+ // We can get NULL pointer because stream can be marked as safely removed
+ if (stream == NULL || !stream->Close()) {
// The only way we can get here is if the sink is in the proccess of being closed
// but is blocked on the mutex waiting to remove the sink from this patch.
// Se we unlock it, and wait for it to do it in the other thread.

Discussion

  • Provided patch is incorrect. OpalMediaPatch::Close() produces endless loop - nobody can't remove elements from sinks collection. There should be another solution for this issue.

     
  • Patch applied to Eridano (PTLib 2.12, OPAL 3.12) and trunk, thank you very much!

     
    • status: open --> closed-accepted