Hi,

regarding that example I would normally do

Something* pS = new Something();
css::uno::Reference<XSomething> x( pS );
pS->privateNonUnoFunction();

Even if privateNonUnoFunction does somehow influence the refcount of the object this has kept the reference.

However you explained the difference between boost::shared_ptr and rtl::Reference very well.

Kind regrads, pl

Stephan Bergmann wrote:
Philipp Lohmann wrote:
Hi,

just as a side note: which added value does rtl::Reference provide over boost::shared_ptr anyway ?

rtl::Reference<T> requirs T to have acquire() and release(), whereas boost::shared_ptr<T> manages the refcount externally . That makes rtl::Reference a good fit when holding references to C++ implementations of UNO objects:

  class Something: public cppu::WeakImplHelper1<XSomething> { ... };
  rtl::Reference<Something> s(new Something);
  s->privateNonUnoFunction();
  css::uno::Reference<XSomething> x(s.get());

etc.


--
If you give someone a program, you will frustrate them for a day;
if you teach them how to program, you will frustrate them for a lifetime.
     -- Author unknown

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to