After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765105 - Embed item_process_async inside proper functions
Embed item_process_async inside proper functions
Status: RESOLVED FIXED
Product: gnome-photos
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME photos maintainer(s)
GNOME photos maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-04-15 13:40 UTC by Rafael Fonseca
Modified: 2016-06-28 16:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
embed process_async inside operation_(add|remove|revert) (24.07 KB, patch)
2016-04-15 20:15 UTC, Rafael Fonseca
none Details | Review
base-item: Shuffle some code around (1.89 KB, patch)
2016-06-28 16:22 UTC, Debarshi Ray
committed Details | Review
Implicitly process the pipeline during add, remove and revert (23.21 KB, patch)
2016-06-28 16:22 UTC, Debarshi Ray
committed Details | Review

Description Rafael Fonseca 2016-04-15 13:40:23 UTC
Instead of having the BaseItem API users call the process_async function every time a photo is changed, we should make it static and embed it into the proper functions:

* photos_base_item_operation_add
* photos_base_item_operation_remove
* photos_base_item_operations_revert
Comment 1 Rafael Fonseca 2016-04-15 20:15:39 UTC
Created attachment 326136 [details] [review]
embed process_async inside operation_(add|remove|revert)
Comment 2 Debarshi Ray 2016-06-28 16:21:18 UTC
Review of attachment 326136 [details] [review]:

Thanks for this clean-up, Rafael. Looks good apart from some minor points:

::: src/photos-base-item.c
@@ +2429,3 @@
+  if (!photos_pipeline_remove (priv->pipeline, operation))
+    {
+      g_task_return_new_error (task, PHOTOS_ERROR, 0, "Remove failed. Not a GeglNode?");

We need a 'goto out'. Otherwise the GTask will be leaked.

@@ -2422,3 @@
-  GTask *task;
-
-  g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));

It would be better to retain these assertions. They are cheap because they use use G_LIKELY, and if we again move this code around, we will benefit from having them.
Comment 3 Debarshi Ray 2016-06-28 16:22:19 UTC
Created attachment 330495 [details] [review]
base-item: Shuffle some code around
Comment 4 Debarshi Ray 2016-06-28 16:22:57 UTC
Created attachment 330496 [details] [review]
Implicitly process the pipeline during add, remove and revert
Comment 5 Debarshi Ray 2016-06-28 16:23:32 UTC
Pushed to master.