Difference between revisions of "Uno/Cpp/Snippet/FreeReference"

From Apache OpenOffice Wiki
< Uno‎ | Cpp
Jump to: navigation, search
m
m (Splitted categories.)
Line 11: Line 11:
 
   ...
 
   ...
 
}
 
}
</code><noinclude>[[Category:Uno:Cpp:Snippet]]</noinclude>
+
</code><noinclude>[[Snippet]][[Category:Cpp]][[Category:Uno]]</noinclude>

Revision as of 08:32, 29 November 2006

[cpp]

  1. include <cppu/EnvGuards.hxx>

... {

 com::sun::star::uno::Reference<XFoo> ref(...)
 ...
 cppu::FreeReference<XFoo> free_xFoo(xFoo);
 cppu::EnvGuard otherEnv(cppu::Environment("just another env"));
 free_xFoo->doSomething(); // the free reference ensures that the correct environment etc. gets activated before invokation
 ...

} Snippet

Personal tools