Bug 67483 - ActUser: make update_info() sync
Summary: ActUser: make update_info() sync
Status: RESOLVED INVALID
Alias: None
Product: accountsservice
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Matthias Clasen
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-29 14:45 UTC by Jonh Wendell
Modified: 2013-07-29 22:01 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
proposed patch (3.02 KB, patch)
2013-07-29 14:48 UTC, Jonh Wendell
Details | Splinter Review

Description Jonh Wendell 2013-07-29 14:45:37 UTC
currently update_info() - in act-user.c - is async.

this behavior breaks the following user case:

call add_new_user_for_object_path()
which in turn calls
_act_user_update_from_object_path()
which in turn calls
update_info()

if this runs async, the user object is returned from add_new_user_for_object_path() almost empty, with only the property 'object_path' filled.

so, the caller is receiving an object user that's invalid in practice:

(gdb) p *user
$5 = {parent = {g_type_instance = {g_class = 0x12afb50}, ref_count = 2, qdata = 0x0}, connection = 0xf55e60, accounts_proxy = 0x18290b0, object_proxy = 0x18001c0, 
  get_all_call = 0x0, object_path = 0x1811810 "/org/freedesktop/Accounts/User1003", uid = 0, user_name = 0x0, real_name = 0x0, password_hint = 0x0, home_dir = 0x0, 
  shell = 0x0, email = 0x0, location = 0x0, icon_file = 0x0, language = 0x0, x_session = 0x0, our_sessions = 0x0, other_sessions = 0x0, login_frequency = 0, login_time = 0, 
  login_history = 0x0, account_type = ACT_USER_ACCOUNT_TYPE_STANDARD, password_mode = ACT_USER_PASSWORD_MODE_REGULAR, uid_set = 0, is_loaded = 0, locked = 0, 
  automatic_login = 0, system_account = 0, local_account = 1, nonexistent = 0}


there's a bug visible in gnome-control-center that's triggered by this behavior:
after cretaing a user, it's not being selected by default. you have to click on the newly-created user so select it. this is why we are receiving this wrong 'User' object.
Comment 1 Jonh Wendell 2013-07-29 14:48:14 UTC
Created attachment 83207 [details] [review]
proposed patch
Comment 2 Ray Strode [halfline] 2013-07-29 15:35:00 UTC
is control-center connecting to notify::loaded before trying to use the user object?
Comment 3 Jonh Wendell 2013-07-29 16:57:58 UTC
(In reply to comment #2)
> is control-center connecting to notify::loaded before trying to use the user
> object?

nope. this the right thing to do, isn't it?
Comment 4 Ray Strode [halfline] 2013-07-29 21:58:13 UTC
yea, exactly.

The api is a little non-standard and could use a revamp to modern constructs, but basically when you get a user it may not be loaded yet, so you watch for the property to toggle over before calling methods on the user object.
Comment 5 Jonh Wendell 2013-07-29 22:01:03 UTC
thanks. I've patched control-center: https://bugzilla.gnome.org/show_bug.cgi?id=704426


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.