Is it possible to store, set or update a value inside an existing GVariant

111 views Asked by At

I have a simple floating-point glib variant object whose value I need to update, but there doesn't seem to be any functions to actually do that.

The only way seems to be to create a new variant object and update all places that have references to this object. The problem is that it's practically hard to impossible to update the references, and it would be much easier to just set the value inside the already existing variant object.

Is it even possible?

1

There are 1 answers

0
Philip Withnall On BEST ANSWER

No, GVariant is immutable after construction by design. This makes it safe to use across multiple threads.

The only way to update the value of a GVariant is to create a new GVariant with the new value.