-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Fix decoding the hints dictionary. #158
Conversation
Back port of 8dad8a7 g_variant_lookup works like g_variant_get, so using a format string of "v" only works if the type is actually a GVariant. Since none of the hints have GVariant values, that means every g_variant_get with a "v" format will fail. Fix all of the g_variant_lookup calls so that they either unpack a value directly, or use a "@" prefix when it's more convenient to fetch the value as a GVariant pointer. In addition, in cases where we do fetch a GVariant, make sure that we unreference it afterward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works fine for me
} | ||
/* deal with x, and y hints */ | ||
else if (g_variant_lookup(hints, "x", "v", &data)) | ||
else if (g_variant_lookup(hints, "x", "i", &x)) | ||
{ | ||
x = g_variant_get_int32 (data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This g_variant_get_int32
call needs to be removed. The g_variant_lookup
call before already assigns the value to x
. data
is going to be either uninitialized or freed at this point.
{ | ||
x = g_variant_get_int32 (data); | ||
|
||
if (g_variant_lookup(hints, "y", "v", &data)) | ||
if (g_variant_lookup(hints, "y", "i", &y)) | ||
{ | ||
y = g_variant_get_int32 (data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above -- the g_variant_lookup
call assigns to y
, so remove the g_variant_get_int32
call.
Two g_variant_get_int32 calls that were removed in the original patch got left in this one. If it makes things easier, I've also got a local branch with this fix on top of 1.22 -- I actually started there because it was easier to diagnose and test on my system. I can submit a PR with that if anyone wants. |
Yes, that would be helpful, thanks!
|
Okay, I just posted #159. |
Thanks, i will close this one. |
Back port of
8dad8a7
@flexiondotorg @vkareh @kbrenneman
Please take a look at it. Commit from master didn't clean apply with a cherry-pick.