Implement a QSharedDataPointer-like method for ensuring that caps and miniobjects...
authorGeorge Kiagiadakis <kiagiadakis.george@gmail.com>
Mon, 21 Jun 2010 11:41:52 +0000 (14:41 +0300)
committerGeorge Kiagiadakis <kiagiadakis.george@gmail.com>
Mon, 21 Jun 2010 11:41:52 +0000 (14:41 +0300)
commit0b86644a3941e726667bdd93560ee6925c8ebe3b
tree483a4ac04e2e985fce3d71913ad6583b193638c2
parent98e2e43eabf84cc7b4cbe5ceab5ecbd5feeab5e1
Implement a QSharedDataPointer-like method for ensuring that caps and miniobjects are writable when needed.

The trick is to get the pointer to the underlying object using an object() method that has a const and
a non-const version. The non-const one calls makeWritable() internally, which makes a copy of the
object if needed, so any non-const method trying to access the underlying object is guaranteed that
it is writable. This is very similar to Qt's implicit sharing mechanism and what QSharedDataPointer does.
18 files changed:
src/QGlib/closure.cpp
src/QGlib/object.cpp
src/QGlib/paramspec.cpp
src/QGlib/refpointer.h
src/QGst/bin.cpp
src/QGst/caps.cpp
src/QGst/caps.h
src/QGst/childproxy.cpp
src/QGst/element.cpp
src/QGst/elementfactory.cpp
src/QGst/ghostpad.cpp
src/QGst/message.cpp
src/QGst/miniobject.cpp
src/QGst/miniobject.h
src/QGst/object.cpp
src/QGst/pad.cpp
src/QGst/pluginfeature.cpp
tests/capstest.cpp