我有一个简单的浮点glib变体对象,我需要更新其值,但是似乎没有任何功能可以实现。
唯一的方法似乎是创建一个新的变体对象并更新所有对该对象的参考的位置。问题在于,很难更新引用,并且仅在已经存在的变体对象中设置值会容易得多。
有可能吗?
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)
no,在设计之后。这使得可以安全地跨多个线程使用。
更新
gvariant
的值的唯一方法是创建一个带有新值的新gvariant
。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 newGVariant
with the new value.