-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling prop.Properties.Set changes the type of value to a pointer #298
Comments
After some investigation, it seems like this was introduced in #217, which tried to fix that structs in I think the best fix would be to make a deep copy of the initial property map, and then only use pointers in |
Thanks for looking into it!
Would this mean that the retrieved value from my example would always be |
Exactly; for purposes of the method calls like |
Without using pointers internally, accepting structs using Store wouldn't work properly. This requires making a copy of the initial values (which were documented already as "initial" values, but were indeed just reused by the existing code). But using them directly was anyway not possible since access not going through Get or GetMust could have led to race conditions anyway. Fixes #298.
Without using pointers internally, accepting structs using Store wouldn't work properly. This requires making a copy of the initial values (which were documented already as "initial" values, but were indeed just reused by the existing code). But using them directly was anyway not possible since access not going through Get or GetMust could have led to race conditions anyway. Fixes #298.
Without using pointers internally, accepting structs using Store wouldn't work properly. This requires making a copy of the initial values (which were documented already as "initial" values, but were indeed just reused by the existing code). But using them directly was anyway not possible since access not going through Get or GetMust could have led to race conditions anyway. Fixes godbus#298.
I stumbled upon this problem while using this library in another project so I tried debugging it by adding the following test case to
prop/prop_test.go
and it fails:The first call to
GetMust
on the server side returns theint32(100
), but after callingSet
it starts returning a pointer.This doesn't happen when I use
SetMust
, but I'd rather my code not to panic if the connection to DBus fails so I have to useSetMust
, but then I have to check the type of value every time which is inconsistent and inconvenient:The text was updated successfully, but these errors were encountered: