http://bugs.winehq.org/show_bug.cgi?id=27168
--- Comment #35 from Ilya Konovalov aragaer@gmail.com 2011-09-28 15:47:02 CDT --- In theory whenever a cert context is duplicated we want to increase the ref counter of a store it belongs. However if we have a collection which contains a store which contains a cert (and we have link1 in collection, link2 in store and data somewhere) if we duplicate a link1 we can increase ref counter only on collection, but not on store. At the same time all ref counters on all cert contexts are increased.
This is because Context_AddRef doesn't know which kind of contexts it is handling. The same actually applies to Context_Release.
The problem is not really related to collections per se. It is actually about how link contexts and their reference counters work currently. The only idea I have is to provide every context with contextInterface which will be used in AddRef and Release.
Another solution, which could sound strange actually, is to not do cascade addref/release at all. Even if some link is duplicated it is still just one reference to whatever it links to. If we need to duplicate that we can do it explicitly.