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

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

Revision as of 11:27, 28 September 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
 ...

}

Personal tools