| Type | recommended |
| Title | weak references for SdrObject, SdrModel and SdrPage |
| Posted by | [EMAIL PROTECTED] |
| Affected | ,svx |
| Effective from | SRC680_m152 |
Summary
weak reference types to SdrObject, SdrModel and SdrPage
Description
+ typedef tools::WeakReference< SdrModel > SdrModelWeakRef;
+ typedef tools::WeakReference< SdrObject > SdrObjectWeakRef;
+ typedef tools::WeakReference< SdrPage > SdrPageWeakRef;
The above drawing layer objects are not refcounted. Still it is
commonly used to have pointers to instances without owning them. In
the past this lead often to crashes due to accessing already deleted
objects.
Instead of a pointer you can now hold a weak reference that
invalidates itself as soon as the target object is destroyed.
Usage:
SdrObject* pObj = ...;
SdrObjectWeakRef xShape( pObj );
...
if( xShape.is() )
xShape->DoSomethingMore();
THIS IS NOT THREADSAFE, you still must lock the solar mutex when you
work with drawing layer objects. So it is guaranteed that no other
thread deletes your target object after you called is().
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
