Discussion:
[zathura] [Zathura PATCH] Use the 64-bit variants of g_param_spec_int and g_value_set_int for installing and accessing the last-view property.
Marwan Tanager
2013-04-01 15:56:57 UTC
Permalink
This fixes the bug of the page cache acting weird (e.g. the same cache index is
invalidated over and over again) after being used for some time. This is
because when we read the last-view property, we only get the least-significant
32 bits of the last_view private member.

---
page-widget.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/page-widget.c b/page-widget.c
index e2b1542..7bcb186 100644
--- a/page-widget.c
+++ b/page-widget.c
@@ -134,7 +134,7 @@ zathura_page_widget_class_init(ZathuraPageClass* class)
g_object_class_install_property(object_class, PROP_DRAW_SEACH_RESULTS,
g_param_spec_boolean("draw-search-results", "draw-search-results", "Set to true if search results should be drawn", FALSE, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(object_class, PROP_LAST_VIEW,
- g_param_spec_int("last-view", "last-view", "Last time the page has been viewed", -1, INT_MAX, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_param_spec_int64("last-view", "last-view", "Last time the page has been viewed", -1, G_MAXINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}

static void
@@ -297,7 +297,7 @@ zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value,
g_value_set_pointer(value, priv->search.list);
break;
case PROP_LAST_VIEW:
- g_value_set_int(value, priv->last_view);
+ g_value_set_int64(value, priv->last_view);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
--
1.7.10.4
Marwan Tanager
2013-04-01 15:56:57 UTC
Permalink
This fixes the bug of the page cache acting weird (e.g. the same cache index is
invalidated over and over again) after being used for some time. This is
because when we read the last-view property, we only get the least-significant
32 bits of the last_view private member.

---
page-widget.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/page-widget.c b/page-widget.c
index e2b1542..7bcb186 100644
--- a/page-widget.c
+++ b/page-widget.c
@@ -134,7 +134,7 @@ zathura_page_widget_class_init(ZathuraPageClass* class)
g_object_class_install_property(object_class, PROP_DRAW_SEACH_RESULTS,
g_param_spec_boolean("draw-search-results", "draw-search-results", "Set to true if search results should be drawn", FALSE, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(object_class, PROP_LAST_VIEW,
- g_param_spec_int("last-view", "last-view", "Last time the page has been viewed", -1, INT_MAX, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_param_spec_int64("last-view", "last-view", "Last time the page has been viewed", -1, G_MAXINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}

static void
@@ -297,7 +297,7 @@ zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value,
g_value_set_pointer(value, priv->search.list);
break;
case PROP_LAST_VIEW:
- g_value_set_int(value, priv->last_view);
+ g_value_set_int64(value, priv->last_view);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
--
1.7.10.4
Loading...