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 731701 - GomFilter from 3 filters fails to find resource
GomFilter from 3 filters fails to find resource
Status: RESOLVED FIXED
Product: gom
Classification: Other
Component: general
0.2.x
Other Linux
: Normal normal
: ---
Assigned To: Gom Maintainers
Gom Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-06-16 03:12 UTC by Victor Toso
Modified: 2014-06-16 10:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GomFilter from 3 filters (15.20 KB, patch)
2014-06-16 03:12 UTC, Victor Toso
reviewed Details | Review
tests: GomFilter from 3 queries (15.25 KB, patch)
2014-06-16 10:49 UTC, Bastien Nocera
committed Details | Review
gom: Fix AND/OR filters memory handling (1.15 KB, patch)
2014-06-16 10:52 UTC, Bastien Nocera
committed Details | Review

Description Victor Toso 2014-06-16 03:12:14 UTC
Created attachment 278507 [details] [review]
GomFilter from 3 filters

I'm trying to use gom as cache for series and episodes database at:
https://bugzilla.gnome.org/show_bug.cgi?id=672933

I'm really not sure if this is a bug or if I'm using the API wrong.

There are two functions in this test: find_simple and find_specific.

find_simple creates a filter with gom_filter_new_like and successfully finds the resource.

find_specific creates a filter from 3 different querys: by series-id, season-number and episode-number;

I'm using gom_filter_new_eq for the season and episode number and gom_filter_new_like to the string series-id;

It does not find the resource.

Thanks for any help,
Comment 1 Bastien Nocera 2014-06-16 10:32:07 UTC
Review of attachment 278507 [details] [review]:

I've added support for guchar (guint8) properties, and made changes to that patch to use that.

That's not the reason for the failure though.

::: tests/test-gom-find-specific.c
@@ +26,3 @@
+  gchar      *series_id;
+  gchar      *imdb_id;
+  guint8      season_number;

You use guint8 here.

@@ +60,3 @@
+  gchar      *series_id;
+  gchar      *imdb_id;
+  guint8      season_number;

And here.

@@ +181,3 @@
+                                   specs[PROP_IMDB_ID]);
+
+  specs[PROP_SEASON_NUMBER] = g_param_spec_int64 (EPISODE_COLUMN_SEASON_NUMBER,

But use int64 for the props.

@@ +233,3 @@
+  g_assert (ret);
+
+  eres = g_object_new (EPISODE_TYPE_RESOURCE,

And somewhere around here, valgrind will complain that some values are initialised on the stack because you overread (64-bit instead of 8).
Comment 2 Bastien Nocera 2014-06-16 10:49:22 UTC
Created attachment 278530 [details] [review]
tests: GomFilter from 3 queries
Comment 3 Bastien Nocera 2014-06-16 10:52:07 UTC
Created attachment 278531 [details] [review]
gom: Fix AND/OR filters memory handling

The values were getting double-freed. As gom_filter_get_values() returns
a new array, no need to stuff it inside another array that we would
create ourselves, just use that original array.
Comment 4 Bastien Nocera 2014-06-16 10:54:22 UTC
Attachment 278530 [details] pushed as e58eda1 - tests: GomFilter from 3 queries
Attachment 278531 [details] pushed as 9369457 - gom: Fix AND/OR filters memory handling