[reSIProcate] Copying SdpContents::Session::Medium objects, possible issues
Hi,
For the following:
SdpContents::Session::Medium::operator=(const Medium& rhs)
{
if (this != &rhs)
{
mSession = 0;
Some questions:
1) mMedia is a collection of Medium objects placed in an STL container. If
the STL container uses the assignment operator to move mediums internally
(due to resizing, etc), then doesn't that Medium object lose the mSession's
Connection and attribute values?
2) If Medium is used outside of the context of Session and it is copied then
doesn't it also lose the mSession values? This seems to make copying
Medium's outside of Session useless.
It's clear that copying mSession across Medium objects is bad, eventually
leading to an access violation once the outside Session pointer is invalid.
What could be done to remove the mSession reference from Medium?
* copy the connection and attribute info to each Medium?
* replace mSession with a shared/weak reference to a copy-on-write object
containing the connection and attribute info at the session level? Would
have to probably be thread safe.
* hide Medium's assignment and copy constructor's from use outside of
Session. and use an alternate method for copying/cloning outside of Session?
* do nothing, it's late and I missed something simple.
Thanks.
-justin