Bug 62215

Summary: [PATCH] Clean up closure handling in the example domain.
Product: realmd Reporter: Marius Vollmer <marius.vollmer>
Component: GeneralAssignee: Stef Walter <stefw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: stefw
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 62214    
Bug Blocks:    
Attachments: Clean up closure handling in the example domain.
Clean up closure handling in the example domain

Description Marius Vollmer 2013-03-12 09:36:39 UTC
Created attachment 76379 [details] [review]
Clean up closure handling in the example domain.

The explicit OpData struct is not necessary, and not what the rest of
the code does.
Comment 1 Stef Walter 2013-03-22 13:39:22 UTC
Comment on attachment 76379 [details] [review]
Clean up closure handling in the example domain.

Review of attachment 76379 [details] [review]:
-----------------------------------------------------------------

I agree. This is better. But just one more thing.

::: service/realm-example.c
@@ +142,5 @@
>                      GAsyncResult *res,
>                      gpointer user_data)
>  {
> +	GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
> +	RealmExample *self = REALM_EXAMPLE (g_simple_async_result_get_op_res_gpointer (async));

You can use g_async_result_get_source_object() here. Keep in mind that it returns a reffed return value (ie: transfer full).

@@ +198,4 @@
>  		g_simple_async_result_complete_in_idle (async);
>  
>  	} else {
> +		g_simple_async_result_set_op_res_gpointer (async, g_object_ref (self), g_object_unref);

Together with the above comment, I don't think this line is necessary.

@@ +212,5 @@
>                       GAsyncResult *res,
>                       gpointer user_data)
>  {
> +	GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
> +	RealmExample *self = REALM_EXAMPLE (g_simple_async_result_get_op_res_gpointer (async));

Ditto.

@@ +283,4 @@
>  		g_simple_async_result_complete_in_idle (async);
>  
>  	} else {
> +		g_simple_async_result_set_op_res_gpointer (async, g_object_ref (self), g_object_unref);

And ditto.

@@ +316,4 @@
>  		g_simple_async_result_complete_in_idle (async);
>  
>  	} else {
> +		g_simple_async_result_set_op_res_gpointer (async, g_object_ref (self), g_object_unref);

Again.
Comment 2 Marius Vollmer 2013-04-12 10:03:23 UTC
(In reply to comment #1)
> Comment on attachment 76379 [details] [review] [review]
> Clean up closure handling in the example domain.
> 
> Review of attachment 76379 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> I agree. This is better. But just one more thing.

Ok, thanks!
Comment 3 Marius Vollmer 2013-04-15 11:29:41 UTC
Created attachment 77990 [details] [review]
Clean up closure handling in the example domain

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.