malcolmstill / foxwhale

A Wayland compositor written in Zig
MIT License
28 stars 0 forks source link

Object parameters should always be pointers? #7

Open malcolmstill opened 4 years ago

malcolmstill commented 4 years ago

Description

The dispatch functions that take Object structs seem to actually get pointers to those Objects, which means the memory can change out from under us if we call register (which may reallocate where the Objects are stored and clobber existing memory).

This issue is not about data getting clobbered (because we should no longer call register mid dispatch function). Rather this is to make it obvious that we can write to the actual Object memory store (it might be that it's not possible to write to the Object if it is not a pointer, only that it's memory can change, in which case the pointer allows us the benefit of being able to update without calling get(id)