diff options
author | infirit <[email protected]> | 2014-05-17 05:15:56 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-09-23 13:31:02 +0200 |
commit | 94dcb761b95ee54ef1f1512d59721932d75ffb7f (patch) | |
tree | 60f89e8174ffc3133c0f1758e2f43408b510c02b /libdocument | |
parent | 53bb92a83092a70170f85d75491c5b0b881455bc (diff) | |
download | atril-94dcb761b95ee54ef1f1512d59721932d75ffb7f.tar.bz2 atril-94dcb761b95ee54ef1f1512d59721932d75ffb7f.tar.xz |
Fix glib deprecations
Based on evince commit by Carlos Garcia Campos <[email protected]>
Url: https://git.gnome.org/browse/evince/commit/?id=bf90f90e0af99bbfdd20e6d21fd228c05cffae51
Url: https://git.gnome.org/browse/evince/commit/?id=76151be92239ed5f491cb26c87a2328b670e9f64
Diffstat (limited to 'libdocument')
-rw-r--r-- | libdocument/ev-document.c | 34 | ||||
-rw-r--r-- | libdocument/ev-mapping-list.c | 2 |
2 files changed, 9 insertions, 27 deletions
diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c index 667f89f1..fc45830d 100644 --- a/libdocument/ev-document.c +++ b/libdocument/ev-document.c @@ -69,8 +69,8 @@ static gchar *_ev_document_get_page_label (EvDocument *document, static EvDocumentInfo *_ev_document_get_info (EvDocument *document); static gboolean _ev_document_support_synctex (EvDocument *document); -GMutex *ev_doc_mutex = NULL; -GMutex *ev_fc_mutex = NULL; +static GMutex ev_doc_mutex; +static GMutex ev_fc_mutex; G_DEFINE_ABSTRACT_TYPE (EvDocument, ev_document, G_TYPE_OBJECT) @@ -160,58 +160,40 @@ ev_document_class_init (EvDocumentClass *klass) g_object_class->finalize = ev_document_finalize; } -GMutex * -ev_document_get_doc_mutex (void) -{ - if (ev_doc_mutex == NULL) { - ev_doc_mutex = g_mutex_new (); - } - return ev_doc_mutex; -} - void ev_document_doc_mutex_lock (void) { - g_mutex_lock (ev_document_get_doc_mutex ()); + g_mutex_lock (&ev_doc_mutex); } void ev_document_doc_mutex_unlock (void) { - g_mutex_unlock (ev_document_get_doc_mutex ()); + g_mutex_unlock (&ev_doc_mutex); } gboolean ev_document_doc_mutex_trylock (void) { - return g_mutex_trylock (ev_document_get_doc_mutex ()); -} - -GMutex * -ev_document_get_fc_mutex (void) -{ - if (ev_fc_mutex == NULL) { - ev_fc_mutex = g_mutex_new (); - } - return ev_fc_mutex; + return g_mutex_trylock (&ev_doc_mutex); } void ev_document_fc_mutex_lock (void) { - g_mutex_lock (ev_document_get_fc_mutex ()); + g_mutex_lock (&ev_fc_mutex); } void ev_document_fc_mutex_unlock (void) { - g_mutex_unlock (ev_document_get_fc_mutex ()); + g_mutex_unlock (&ev_fc_mutex); } gboolean ev_document_fc_mutex_trylock (void) { - return g_mutex_trylock (ev_document_get_fc_mutex ()); + return g_mutex_trylock (&ev_fc_mutex); } /** diff --git a/libdocument/ev-mapping-list.c b/libdocument/ev-mapping-list.c index 6c670158..44628b09 100644 --- a/libdocument/ev-mapping-list.c +++ b/libdocument/ev-mapping-list.c @@ -136,7 +136,7 @@ ev_mapping_list_unref (EvMappingList *mapping_list) g_return_if_fail (mapping_list != NULL); g_return_if_fail (mapping_list->ref_count > 0); - if (g_atomic_int_exchange_and_add (&mapping_list->ref_count, -1) - 1 == 0) { + if (g_atomic_int_add (&mapping_list->ref_count, -1) - 1 == 0) { g_list_foreach (mapping_list->list, (GFunc)mapping_list_free_foreach, mapping_list->data_destroy_func); |