Answered by:
Weak reference to ref class

Question
-
Is there any way to create a weak reference to a ref class? If not, can ^ references be released and be used afterwards as weak refs?
I found some information about the WeakRef and IWeakReference classes, but I didn't find anything about how to use them, except the following blog post:http://paoloseverini.wordpress.com/2011/10/04/weak-references-and-how-to-write-winrt-classes-without-wx/, but this seems to be overkill in this situation (fully implement the boilerplate COM-code by hand just to be able to have weak references?).
There are similar threads in the forum, but they are quite old, I hope the situation improved since the Dev and the Consumer previews.
Monday, July 30, 2012 8:12 AM
Answers
-
-
In addition, please check this thread
Best regards,
Jesse
Jesse Jiang [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Jesse Jiang Thursday, August 2, 2012 7:13 AM
Tuesday, July 31, 2012 7:34 AM
All replies
-
-
In addition, please check this thread
Best regards,
Jesse
Jesse Jiang [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Jesse Jiang Thursday, August 2, 2012 7:13 AM
Tuesday, July 31, 2012 7:34 AM -
Thanks for the info. I tried WeakReference, but it was quite inconvenient to use, because it is not templated and it is a native type (so it can't be a parameter of a public function of a WinRT component).
Probably instead of weak references I am going to alter my design to avoid cycles.Monday, August 6, 2012 3:36 PM