[librsvg] Don't extract a GCancellable from the RsvgHandle
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Don't extract a GCancellable from the RsvgHandle
- Date: Thu, 6 Dec 2018 00:47:19 +0000 (UTC)
commit 172c746762a5cb5b677292c70324c3b2d932594c
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Dec 5 18:45:34 2018 -0600
Don't extract a GCancellable from the RsvgHandle
The handle->priv->cancellable was never actually set! It was always
NULL.
So, the inner functions which thought they may be able to get a
cancellable, in fact were never getting one.
We'll refactor this to pass around a loading context with the
cancellable and maybe other things.
librsvg/rsvg-handle.c | 10 ----------
librsvg/rsvg-load.c | 2 +-
librsvg/rsvg-private.h | 5 -----
rsvg_internals/src/handle.rs | 16 +++++-----------
4 files changed, 6 insertions(+), 27 deletions(-)
---
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index 6c167c11..8c840732 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -197,8 +197,6 @@ rsvg_handle_init (RsvgHandle * self)
self->priv->dpi_x = rsvg_internal_dpi_x;
self->priv->dpi_y = rsvg_internal_dpi_y;
- self->priv->cancellable = NULL;
-
self->priv->in_loop = FALSE;
self->priv->is_testing = FALSE;
@@ -230,8 +228,6 @@ rsvg_handle_dispose (GObject *instance)
g_clear_object (&self->priv->font_map_for_testing);
#endif
- g_clear_object (&self->priv->cancellable);
-
g_clear_pointer (&self->priv->rust_handle, rsvg_handle_rust_free);
G_OBJECT_CLASS (rsvg_handle_parent_class)->dispose (instance);
@@ -1566,12 +1562,6 @@ rsvg_handle_set_size_callback (RsvgHandle * handle,
handle->priv->user_data_destroy = user_data_destroy;
}
-GCancellable *
-rsvg_handle_get_cancellable (RsvgHandle *handle)
-{
- return handle->priv->cancellable;
-}
-
#ifdef HAVE_PANGOFT2
static void
diff --git a/librsvg/rsvg-load.c b/librsvg/rsvg-load.c
index dcbd147d..0468899f 100644
--- a/librsvg/rsvg-load.c
+++ b/librsvg/rsvg-load.c
@@ -160,7 +160,7 @@ rsvg_load_handle_xml_xinclude (RsvgHandle *handle, const char *href)
success = rsvg_xml_state_parse_from_stream (handle->priv->load->xml.rust_state,
handle->priv->load->unlimited_size,
stream,
- handle->priv->cancellable,
+ NULL, /* cancellable */
NULL);
g_object_unref (stream);
diff --git a/librsvg/rsvg-private.h b/librsvg/rsvg-private.h
index 0b5adc7e..af829a0b 100644
--- a/librsvg/rsvg-private.h
+++ b/librsvg/rsvg-private.h
@@ -94,8 +94,6 @@ struct RsvgHandlePrivate {
gpointer user_data;
GDestroyNotify user_data_destroy;
- GCancellable *cancellable;
-
double dpi_x;
double dpi_y;
@@ -136,9 +134,6 @@ char *rsvg_handle_acquire_data (RsvgHandle *handle,
gsize *len,
GError **error);
-G_GNUC_INTERNAL
-GCancellable *rsvg_handle_get_cancellable (RsvgHandle *handle);
-
/* Implemented in rsvg_internals/src/handle.rs */
G_GNUC_INTERNAL
GInputStream *rsvg_handle_acquire_stream (RsvgHandle *handle,
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index a7683db5..864e7dc0 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -6,7 +6,7 @@ use std::rc::Rc;
use cairo::{ImageSurface, Status};
use cairo_sys;
use gdk_pixbuf::{PixbufLoader, PixbufLoaderExt};
-use gio::{Cancellable, File as GFile, InputStream};
+use gio::{File as GFile, InputStream};
use gio_sys;
use glib::translate::*;
use glib_sys;
@@ -61,8 +61,6 @@ extern "C" {
) -> glib_sys::gboolean;
fn rsvg_handle_get_rust(handle: *const RsvgHandle) -> *mut RsvgHandleRust;
-
- fn rsvg_handle_get_cancellable(handle: *const RsvgHandle) -> *mut gio_sys::GCancellable;
}
pub fn lookup_node(handle: *const RsvgHandle, fragment: &Fragment) -> Option<Rc<Node>> {
@@ -120,27 +118,23 @@ pub fn get_base_url<'a>(handle: *const RsvgHandle) -> Ref<'a, Option<Url>> {
rhandle.base_url.borrow()
}
-fn get_cancellable<'a>(handle: *const RsvgHandle) -> Option<Cancellable> {
- unsafe { from_glib_borrow(rsvg_handle_get_cancellable(handle)) }
-}
-
pub struct BinaryData {
pub data: Vec<u8>,
pub content_type: Option<String>,
}
pub fn acquire_data(
- handle: *mut RsvgHandle,
+ _handle: *mut RsvgHandle,
aurl: &AllowedUrl,
) -> Result<BinaryData, LoadingError> {
- io::acquire_data(aurl, get_cancellable(handle).as_ref())
+ io::acquire_data(aurl, None)
}
pub fn acquire_stream(
- handle: *mut RsvgHandle,
+ _handle: *mut RsvgHandle,
aurl: &AllowedUrl,
) -> Result<InputStream, LoadingError> {
- io::acquire_stream(&aurl, get_cancellable(handle).as_ref())
+ io::acquire_stream(&aurl, None)
}
fn keep_image_data(handle: *const RsvgHandle) -> bool {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]