Skip to content

v0.2 - Embracing re-entrancy

Latest

Choose a tag to compare

@prokopyl prokopyl released this 12 Sep 15:44

This release brings a few breaking improvements and fixes, but the main focus of it is the support of re-entrant plugin/host calls on the main thread.

Support re-entrancy on the main thread

Previously, re-entrantly calling host or plugin methods was disallowed, due to all of them requiring &mut on handles. For the same reason, the main-thread interfaces required &mut self, which would cause UB if hosts called plug-in methods re-entrantly (or vice-versa).

This release fixes both issues by simply only requiring and issuing shared & references in both cases.

This change is simple on the surface, but has significant repercussions:

  • Implementers must now rewrite their methods to support mutating their state while operating with shared & references, e.g. by using Cell, OnceCell or RefCell.
  • Implementers must do so while being wary of the possibility of re-entrant function calls, both to the same function and to different functions.

GUI: Expanded safe use of the Window object

This release adds a new 'w lifetime on the Window type (from the gui extension), which represents the lifetime of the underlying window handle.

(The previously existing 'a lifetime only tracked the gui_api_type's field's lifetime.)

This change allows to track the underlying window handle lifetime, and therefore allows to implement the new RawWindowHandle APIs safely.

What's Changed

New Contributors

Full Changelog: v0.1.1...v0.2