/srv/irclogs.ubuntu.com/2012/08/04/#ubuntu-desktop.txt

smspillazdesrt: hey, do you know if g_settings_unref is meant to implicitly unref any value that you might have retrived from the same key using g_settings_get_value ?04:12
smspillazI seem to have to do:04:13
smspillazGVariant *v = g_settings_get_value (settings, "key");04:13
smspillazg_variant_ref (v);04:13
smspillazg_settings_reset (v);04:13
smspillazerm, - g_settings_reset (settings, "key");04:13
smspillazg_variant_unref (v);04:13
smspillazin order to not get a warning about a double unref04:13
smspillaz(valgrind says there are no leaks when I do that as well)04:14
smspillazoh, s/g_settings_unref/g_settings_reset04:14
Maiz_en_Hecesanybody here?06:35
=== tkamppeter_ is now known as tkamppeter
MCR1smspillaz: Hi :) Are you here ?08:21
ahoneybunI can not log into pad.ubuntu.com16:09
desrtsmspillaz: erm...16:27
desrtsmspillaz: g_settings_get_value() returns a reference.  you should call unref() on the return value, not ref.16:28
desrtit's possible your refcounting issues lie elsewhere16:28
desrtfor example, i hope you're not doing something like this:16:28
desrtv = g_variant_new_int32 (4);16:28
desrtg_settings_set_value (s, "foo", v);16:28
desrtg_variant_unref (v);16:28
=== jalcine is now known as Jacky
=== elleuca is now known as Guest51523
smspillazdesrt: right, I am using set_value23:44
smspillazdesrt: anything in particular I should know? I need to wrap the API for testing purposes and varargs aren't really territory I want to venture into23:44
smspillazdesrt: so to clarify, I'm doing something like23:46
smspillazv = g_variant_new_int32 (blah);23:46
smspillazg_settings_set_value (v);23:46
smspillazg_settings_reset_key (key);23:46
desrtso far so good23:46
smspillazI did notice the documentation said that set_value consumes the reference23:46
desrtyup.  that's true.23:47
smspillazokay, so actually I'll amend that example23:47
smspillaz(I just woke up)23:47
desrtmaybe you should use a pastebin :)23:47
smspillazv = g_variant_new_blah23:47
smspillazdesrt: you'll see all my wrapper code, it will make it kinda confusing23:47
smspillazbut, considering it a very thin wrapper, okay23:48
desrtsmspillaz: you're the one that's confused :)23:48
* desrt can probably dig through the layers23:48
smspillazhttp://paste.ubuntu.com/1129829/23:48
desrtuh...23:48
desrtboost::shared_ptr<GVariant>?23:48
smspillazuh ?23:48
desrtwhat is this magic? :)23:48
smspillazit auto-unrefs the variant on destruction23:49
smspillazthat's probably where the problem lies if the reference is consumed hey23:49
desrtare you sure that it's aware of floating references?23:49
* desrt guesses it's not23:49
smspillazno, its very stupid23:49
desrti bet that's where your bug is then23:49
smspillazright, well, as long as it doesn't affect user code (I don't do this in user code)23:49
smspillazbut at least now I know the behaviour is correct23:49
desrtyou're right.  i'm confused.23:50
desrtcan you please produce a failing testcase in C?23:50
desrtso that we can rule out some c++ crack causing problems23:50
smspillazdesrt: it is the C++ crack :)23:50
desrt(which is still my leading theory at this point)23:50
desrtoh.  good.23:50
desrtproblem solved :D23:50
smspillazdesrt: the failing test case at this point in c would be g_variant_new .. g_settings_set_value ... g_settings_reset ... g_variant_unref23:50
smspillazas you mentioend earlier23:50
smspillazso I guess as long as I ref it with the comment there its probably fine23:51
desrtmaybe you should avoid mixing shared_ptr with floating refcounts23:51
smspillazdesrt: its only really for testing purposes23:51
desrtor do what vala does: wrap the call to the constructor with g_variant_ref_sink()23:51
smspillazcould work too23:51
smspillazdesrt: I'm assuming btw that GSettings isn't an implementation of some GInterface somewhere I can mock as well23:53
smspillazso I'm okay in creating my own wrapper for testing purposes23:53
desrtnope.23:55
smspillazI'm not okay, or its not an interface ?23:55
desrtyou can implement your own backend, though23:55
desrtand there are some built-in backends that are useful for testing23:55
smspillazright, there's the memory backend23:56
desrtya.  that's a popular favourite.23:56
smspillazalthough I actually wanted to mock out the object alltogether23:56
desrtya.  you can't do that.23:56
smspillazannnd why not ?23:56
desrtbecause it's not an interface23:56
smspillazbut is it sane if I wrap it in another object which *is* an interface ?23:56
desrtone thing you could do, though, is just write your own version of the API23:56
desrtwith the same symbol names23:56
smspillazright that's what I just did23:56
desrtthat will work as long as you don't plan to use anything else in GIO23:56
smspillazsure23:57
desrtwhich you're probably not doing...23:57
desrtjust don't like -lgio23:57
smspillaz+!23:57
desrt*link23:57
smspillazyep23:57
smspillazits not the same symbol names but just a wrapper class23:57
smspillazanyways23:57
smspillazI'm assuming I'm fine23:57
* desrt mumbles something about this being much harder than it should be23:58
smspillazright, I remember I had to wrap it for some non-trivial reason23:58
* ogra_ mumbles the same about life every day23:58
smspillazlike not noting to carry the burden of requiring a schemafile for tests and everything etc23:58
smspillaz*not having to23:58
smspillazbut I just woke up so23:58
smspillazyeah23:58
desrtthe non-trivial reason is that compiz resembles emacs23:58
smspillazvery funny23:59
ogra_it has a kitchen sink now ?23:59

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!