Code Monkey home page Code Monkey logo

Comments (1)

kennykerr avatar kennykerr commented on August 18, 2024

Spent a bit of time debugging this on my end. A few thoughts before I get back to work and forget all about this. 😉

  • C++/WinRT support for weak references is limited to non-composable or at least non-open composable hierarchies. That's because it's implemented by swapping out the ref count on the object while open composable types delegate ref counting to the outer/derived object and thus there's really two ref counts at play and that's not supported by the C++/WinRT weak reference implementation.
  • C++/WinRT support for open/binary composable hierarchies is limited to Xaml. Nothing else has ever been tested nor is it recommended.
  • To the best of my knowledge, the base composable type in Xaml has always been implemented in something other than C++/WinRT. Its that base composable type(s) that must implement weak reference support. Derived types cannot do it - they simply delegate to the base.
  • You may want to confirm that a derived type in the binary hierarchy isn't accidentally responding to queries for IWeakReferenceSource. That would be a big problem.
  • You can instruct C++/WinRT not to implement weak reference support for a particular implementation by using the no_weak_ref marker type.

Here's a more minimal example of open composability in C++/WinRT for debugging purposes only:

https://gist.github.com/kennykerr/2a5dd202274f49031adbd50e02d8b4d0

from cppwinrt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.