[epiphany/mcatanzaro/slice-slice] Stop using the slice allocator



commit 5b41cafeb9586598a36d5d9a3666da69295c17a8
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Dec 4 16:16:39 2018 -0600

    Stop using the slice allocator
    
    In Epiphany we currently use the slice allocator for random structs,
    then fill the structs with memory inevitably managed by system malloc.
    There's no rhyme or reason to it. The slice allocator has fallen out of
    favor, so stop using it. See:
    
    https://gitlab.gnome.org/GNOME/glib/issues/1079

 embed/ephy-embed.c                            |  6 ++---
 embed/ephy-filters-manager.c                  |  4 ++--
 embed/ephy-view-source-handler.c              |  4 ++--
 embed/ephy-web-view.c                         | 12 +++++-----
 embed/web-extension/ephy-web-overview-model.c |  4 ++--
 lib/ephy-smaps.c                              |  9 ++++----
 lib/ephy-snapshot-service.c                   |  5 ++---
 lib/ephy-uri-helpers.c                        |  4 ++--
 lib/ephy-web-app-utils.c                      |  4 ++--
 lib/history/ephy-history-service.c            |  8 +++----
 lib/history/ephy-history-types.c              | 17 +++++++-------
 lib/safe-browsing/ephy-gsb-utils.c            | 20 ++++++++---------
 lib/sync/ephy-history-manager.c               |  4 ++--
 lib/sync/ephy-history-record.c                |  4 ++--
 lib/sync/ephy-password-manager.c              | 16 +++++++-------
 lib/sync/ephy-sync-crypto.c                   | 22 +++++++++---------
 lib/sync/ephy-sync-service.c                  | 20 ++++++++---------
 lib/widgets/ephy-location-entry.c             |  4 ++--
 src/ephy-session.c                            | 32 +++++++++++++--------------
 src/ephy-shell.c                              | 11 +++++----
 src/ephy-window.c                             |  8 +++----
 src/synced-tabs-dialog.c                      |  4 ++--
 src/window-commands.c                         |  4 ++--
 23 files changed, 111 insertions(+), 115 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index db365cf26..2360a574d 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -183,7 +183,7 @@ ephy_embed_statusbar_push (EphyEmbed *embed, guint context_id, const char *text)
   g_assert (context_id != 0);
   g_assert (text != NULL);
 
-  msg = g_slice_new (EphyEmbedStatusbarMsg);
+  msg = g_new (EphyEmbedStatusbarMsg, 1);
   msg->text = g_strdup (text);
   msg->context_id = context_id;
   msg->message_id = embed->seq_message_id++;
@@ -212,7 +212,7 @@ ephy_embed_statusbar_pop (EphyEmbed *embed, guint context_id)
     if (msg->context_id == context_id) {
       embed->messages = g_slist_remove_link (embed->messages, list);
       g_free (msg->text);
-      g_slice_free (EphyEmbedStatusbarMsg, msg);
+      g_free (msg);
       g_slist_free_1 (list);
       break;
     }
@@ -414,7 +414,7 @@ ephy_embed_finalize (GObject *object)
 
     msg = list->data;
     g_free (msg->text);
-    g_slice_free (EphyEmbedStatusbarMsg, msg);
+    g_free (msg);
   }
 
   g_slist_free (embed->messages);
diff --git a/embed/ephy-filters-manager.c b/embed/ephy-filters-manager.c
index d69e1c2c9..0bc00264f 100644
--- a/embed/ephy-filters-manager.c
+++ b/embed/ephy-filters-manager.c
@@ -91,7 +91,7 @@ adblock_filter_retrieve_data_new (EphyFiltersManager *manager,
                                   const char         *source_uri)
 {
   AdblockFilterRetrieveData* data;
-  data = g_slice_new (AdblockFilterRetrieveData);
+  data = g_new (AdblockFilterRetrieveData, 1);
   data->manager = g_object_ref (manager);
   data->download = g_object_ref (download);
   data->source_uri = g_strdup (source_uri);
@@ -104,7 +104,7 @@ adblock_filter_retrieve_data_free (AdblockFilterRetrieveData *data)
   g_object_unref (data->manager);
   g_object_unref (data->download);
   g_free (data->source_uri);
-  g_slice_free (AdblockFilterRetrieveData, data);
+  g_free (data);
 }
 
 static void
diff --git a/embed/ephy-view-source-handler.c b/embed/ephy-view-source-handler.c
index 31aadfcbd..3b7fbda10 100644
--- a/embed/ephy-view-source-handler.c
+++ b/embed/ephy-view-source-handler.c
@@ -51,7 +51,7 @@ ephy_view_source_request_new (EphyViewSourceHandler  *handler,
 {
   EphyViewSourceRequest *view_source_request;
 
-  view_source_request = g_slice_new (EphyViewSourceRequest);
+  view_source_request = g_new (EphyViewSourceRequest, 1);
   view_source_request->source_handler = g_object_ref (handler);
   view_source_request->scheme_request = g_object_ref (request);
   view_source_request->web_view = NULL; /* created only if required */
@@ -74,7 +74,7 @@ ephy_view_source_request_free (EphyViewSourceRequest *request)
   g_cancellable_cancel (request->cancellable);
   g_object_unref (request->cancellable);
 
-  g_slice_free (EphyViewSourceRequest, request);
+  g_free (request);
 }
 
 static void
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 875f0e7b2..0058d82ac 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -176,7 +176,7 @@ popups_manager_free_info (PopupInfo *popup)
   g_free (popup->url);
   g_free (popup->name);
   g_free (popup->features);
-  g_slice_free (PopupInfo, popup);
+  g_free (popup);
 }
 
 static void
@@ -241,7 +241,7 @@ popups_manager_add (EphyWebView *view,
   LOG ("popups_manager_add: view %p, url %s, features %s",
        view, url, features);
 
-  popup = g_slice_new (PopupInfo);
+  popup = g_new (PopupInfo, 1);
 
   popup->url = g_strdup (url);
   popup->name = g_strdup (name);
@@ -1474,7 +1474,7 @@ permission_request_data_new (EphyWebView             *web_view,
                              const char              *origin)
 {
   PermissionRequestData *data;
-  data = g_slice_new (PermissionRequestData);
+  data = g_new (PermissionRequestData, 1);
   data->web_view = web_view;
   /* Ref the decision to keep it alive while we decide */
   data->request = g_object_ref (request);
@@ -1487,7 +1487,7 @@ permission_request_data_free (PermissionRequestData *data)
 {
   g_object_unref (data->request);
   g_free (data->origin);
-  g_slice_free (PermissionRequestData, data);
+  g_free (data);
 }
 
 static void
@@ -3334,7 +3334,7 @@ get_best_web_app_icon_async_data_free (GetBestWebAppIconAsyncData *data)
   g_free (data->icon_uri);
   g_free (data->icon_color);
 
-  g_slice_free (GetBestWebAppIconAsyncData, data);
+  g_free (data);
 }
 
 static void
@@ -3350,7 +3350,7 @@ get_best_web_app_icon_cb (WebKitWebView *view,
     JSCValue *js_value, *js_uri, *js_color;
     GetBestWebAppIconAsyncData *data;
 
-    data = g_slice_new0 (GetBestWebAppIconAsyncData);
+    data = g_new0 (GetBestWebAppIconAsyncData, 1);
     js_value = webkit_javascript_result_get_js_value (js_result);
     g_assert (jsc_value_is_object (js_value));
 
diff --git a/embed/web-extension/ephy-web-overview-model.c b/embed/web-extension/ephy-web-overview-model.c
index 6ca2abe96..68ec016fe 100644
--- a/embed/web-extension/ephy-web-overview-model.c
+++ b/embed/web-extension/ephy-web-overview-model.c
@@ -330,7 +330,7 @@ ephy_web_overview_model_item_new (const char *url,
 {
   EphyWebOverviewModelItem *item;
 
-  item = g_slice_new0 (EphyWebOverviewModelItem);
+  item = g_new0 (EphyWebOverviewModelItem, 1);
   item->url = g_strdup (url);
   item->title = g_strdup (title);
 
@@ -346,7 +346,7 @@ ephy_web_overview_model_item_free (EphyWebOverviewModelItem *item)
   g_free (item->url);
   g_free (item->title);
 
-  g_slice_free (EphyWebOverviewModelItem, item);
+  g_free (item);
 }
 
 static void
diff --git a/lib/ephy-smaps.c b/lib/ephy-smaps.c
index f298c1771..3a1b987ae 100644
--- a/lib/ephy-smaps.c
+++ b/lib/ephy-smaps.c
@@ -102,13 +102,12 @@ static void vma_free (VMA_t *vma)
   g_free (vma->private_clean);
   g_free (vma->private_dirty);
 
-  g_slice_free (VMA_t, vma);
+  g_free (vma);
 }
 
 static void perm_entry_free (PermEntry *entry)
 {
-  if (entry)
-    g_slice_free (PermEntry, entry);
+  g_free (entry);
 }
 
 static void add_to_perm_entry (GHashTable *hash, VMA_t *entry)
@@ -121,7 +120,7 @@ static void add_to_perm_entry (GHashTable *hash, VMA_t *entry)
   value = g_hash_table_lookup (hash, perms);
 
   if (!value) {
-    value = g_slice_new0 (PermEntry);
+    value = g_new0 (PermEntry, 1);
     insert = TRUE;
   }
 
@@ -228,7 +227,7 @@ static void ephy_smaps_pid_to_html (EphySMaps *smaps, GString *str, pid_t pid, E
       if (vma)
         vma_entries = g_slist_append (vma_entries, vma);
 
-      vma = g_slice_new0 (VMA_t);
+      vma = g_new0 (VMA_t, 1);
 
       vma->start = g_match_info_fetch (match_info, 1);
       vma->end = g_match_info_fetch (match_info, 2);
diff --git a/lib/ephy-snapshot-service.c b/lib/ephy-snapshot-service.c
index 6e824b066..929b41a92 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -288,7 +288,7 @@ snapshot_async_data_new (EphySnapshotService *service,
 {
   SnapshotAsyncData *data;
 
-  data = g_slice_new0 (SnapshotAsyncData);
+  data = g_new0 (SnapshotAsyncData, 1);
   data->service = g_object_ref (service);
   data->snapshot = snapshot ? g_object_ref (snapshot) : NULL;
   data->web_view = web_view;
@@ -320,8 +320,7 @@ snapshot_async_data_free (SnapshotAsyncData *data)
     g_object_remove_weak_pointer (G_OBJECT (data->web_view), (gpointer *)&data->web_view);
 
   g_free (data->url);
-
-  g_slice_free (SnapshotAsyncData, data);
+  g_free (data);
 }
 
 typedef struct {
diff --git a/lib/ephy-uri-helpers.c b/lib/ephy-uri-helpers.c
index 43ebe610a..32b3ef3a4 100644
--- a/lib/ephy-uri-helpers.c
+++ b/lib/ephy-uri-helpers.c
@@ -48,7 +48,7 @@ query_item_free (QueryItem *item)
 {
   g_free (item->decoded_name);
   g_free (item->pair);
-  g_slice_free (QueryItem, item);
+  g_free (item);
 }
 
 #define XDIGIT(c) ((c) <= '9' ? (c) - '0' : ((c) & 0x4F) - 'A' + 10)
@@ -103,7 +103,7 @@ query_split (const char *query)
       decoded_name = NULL;
     }
 
-    item = g_slice_new0 (QueryItem);
+    item = g_new0 (QueryItem, 1);
     item->decoded_name = decoded_name;
     item->pair = pair;
     items = g_list_prepend (items, item);
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index 422519424..5352bed0f 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -471,7 +471,7 @@ ephy_web_application_free (EphyWebApplication *app)
   g_free (app->icon_url);
   g_free (app->url);
   g_free (app->desktop_file);
-  g_slice_free (EphyWebApplication, app);
+  g_free (app);
 }
 
 
@@ -494,7 +494,7 @@ ephy_web_application_for_profile_directory (const char *profile_dir)
   if (!id)
     return NULL;
 
-  app = g_slice_new0 (EphyWebApplication);
+  app = g_new0 (EphyWebApplication, 1);
   app->id = g_strdup (id);
 
   app->desktop_file = get_app_desktop_filename (id);
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index de3fa6930..4e0fad3a4 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -325,7 +325,7 @@ ephy_history_service_message_new (EphyHistoryService           *service,
                                   EphyHistoryJobCallback        callback,
                                   gpointer                      user_data)
 {
-  EphyHistoryServiceMessage *message = g_slice_alloc0 (sizeof (EphyHistoryServiceMessage));
+  EphyHistoryServiceMessage *message = g_new0 (EphyHistoryServiceMessage, 1);
 
   message->service = service;
   message->type = type;
@@ -347,7 +347,7 @@ ephy_history_service_message_free (EphyHistoryServiceMessage *message)
   if (message->cancellable)
     g_object_unref (message->cancellable);
 
-  g_slice_free1 (sizeof (EphyHistoryServiceMessage), message);
+  g_free (message);
 }
 
 static void
@@ -523,7 +523,7 @@ signal_emission_context_free (SignalEmissionContext *ctx)
   g_object_unref (ctx->service);
   if (ctx->destroy_func && ctx->user_data)
     ctx->destroy_func (ctx->user_data);
-  g_slice_free (SignalEmissionContext, ctx);
+  g_free (ctx);
 }
 
 static SignalEmissionContext *
@@ -531,7 +531,7 @@ signal_emission_context_new (EphyHistoryService *service,
                              gpointer            user_data,
                              GDestroyNotify      destroy_func)
 {
-  SignalEmissionContext *ctx = g_slice_new0 (SignalEmissionContext);
+  SignalEmissionContext *ctx = g_new0 (SignalEmissionContext, 1);
 
   ctx->service = g_object_ref (service);
   ctx->user_data = user_data;
diff --git a/lib/history/ephy-history-types.c b/lib/history/ephy-history-types.c
index f8ed32262..779a06add 100644
--- a/lib/history/ephy-history-types.c
+++ b/lib/history/ephy-history-types.c
@@ -25,7 +25,7 @@
 EphyHistoryPageVisit *
 ephy_history_page_visit_new_with_url (EphyHistoryURL *url, gint64 visit_time, EphyHistoryPageVisitType 
visit_type)
 {
-  EphyHistoryPageVisit *visit = g_slice_alloc0 (sizeof (EphyHistoryPageVisit));
+  EphyHistoryPageVisit *visit = g_new0 (EphyHistoryPageVisit, 1);
   visit->id = -1;
   visit->url = url;
   visit->visit_time = visit_time;
@@ -47,7 +47,7 @@ ephy_history_page_visit_free (EphyHistoryPageVisit *visit)
     return;
 
   ephy_history_url_free (visit->url);
-  g_slice_free1 (sizeof (EphyHistoryPageVisit), visit);
+  g_free (visit);
 }
 
 EphyHistoryPageVisit *
@@ -80,7 +80,7 @@ ephy_history_page_visit_list_free (GList *list)
 EphyHistoryHost *
 ephy_history_host_new (const char *url, const char *title, int visit_count, double zoom_level)
 {
-  EphyHistoryHost *host = g_slice_alloc0 (sizeof (EphyHistoryHost));
+  EphyHistoryHost *host = g_new0 (EphyHistoryHost, 1);
 
   host->id = -1;
   host->url = g_strdup (url);
@@ -116,14 +116,13 @@ ephy_history_host_free (EphyHistoryHost *host)
 
   g_free (host->url);
   g_free (host->title);
-
-  g_slice_free1 (sizeof (EphyHistoryHost), host);
+  g_free (host);
 }
 
 EphyHistoryURL *
 ephy_history_url_new (const char *url, const char *title, int visit_count, int typed_count, gint64 
last_visit_time)
 {
-  EphyHistoryURL *history_url = g_slice_alloc0 (sizeof (EphyHistoryURL));
+  EphyHistoryURL *history_url = g_new0 (EphyHistoryURL, 1);
   history_url->id = -1;
   history_url->url = g_strdup (url);
   history_url->title = g_strdup (title);
@@ -169,7 +168,7 @@ ephy_history_url_free (EphyHistoryURL *url)
   g_free (url->title);
   g_free (url->sync_id);
   ephy_history_host_free (url->host);
-  g_slice_free1 (sizeof (EphyHistoryURL), url);
+  g_free (url);
 }
 
 GList *
@@ -200,14 +199,14 @@ ephy_history_url_list_free (GList *list)
 EphyHistoryQuery *
 ephy_history_query_new (void)
 {
-  return (EphyHistoryQuery *)g_slice_alloc0 (sizeof (EphyHistoryQuery));
+  return g_new0 (EphyHistoryQuery, 1);
 }
 
 void
 ephy_history_query_free (EphyHistoryQuery *query)
 {
   g_list_free_full (query->substring_list, g_free);
-  g_slice_free1 (sizeof (EphyHistoryQuery), query);
+  g_free (query);
 }
 
 EphyHistoryQuery *
diff --git a/lib/safe-browsing/ephy-gsb-utils.c b/lib/safe-browsing/ephy-gsb-utils.c
index e448c7bbf..9abb4511d 100644
--- a/lib/safe-browsing/ephy-gsb-utils.c
+++ b/lib/safe-browsing/ephy-gsb-utils.c
@@ -55,7 +55,7 @@ ephy_gsb_bit_reader_new (const guint8 *data,
   g_assert (data);
   g_assert (data_len > 0);
 
-  reader = g_slice_new (EphyGSBBitReader);
+  reader = g_new (EphyGSBBitReader, 1);
   reader->curr = reader->data = g_malloc (data_len);
   memcpy (reader->data, data, data_len);
   reader->data_len = data_len;
@@ -71,7 +71,7 @@ ephy_gsb_bit_reader_free (EphyGSBBitReader *reader)
   g_assert (reader);
 
   g_free (reader->data);
-  g_slice_free (EphyGSBBitReader, reader);
+  g_free (reader);
 }
 
 /*
@@ -116,7 +116,7 @@ ephy_gsb_rice_decoder_new (const guint8 *data,
   g_assert (data);
   g_assert (data_len > 0);
 
-  decoder = g_slice_new (EphyGSBRiceDecoder);
+  decoder = g_new (EphyGSBRiceDecoder, 1);
   decoder->reader = ephy_gsb_bit_reader_new (data, data_len);
   decoder->parameter = parameter;
 
@@ -129,7 +129,7 @@ ephy_gsb_rice_decoder_free (EphyGSBRiceDecoder *decoder)
   g_assert (decoder);
 
   ephy_gsb_bit_reader_free (decoder->reader);
-  g_slice_free (EphyGSBRiceDecoder, decoder);
+  g_free (decoder);
 }
 
 static guint32
@@ -161,7 +161,7 @@ ephy_gsb_threat_list_new (const char *threat_type,
   g_assert (platform_type);
   g_assert (threat_entry_type);
 
-  list = g_slice_new (EphyGSBThreatList);
+  list = g_new (EphyGSBThreatList, 1);
   list->threat_type = g_strdup (threat_type);
   list->platform_type = g_strdup (platform_type);
   list->threat_entry_type = g_strdup (threat_entry_type);
@@ -178,7 +178,7 @@ ephy_gsb_threat_list_free (EphyGSBThreatList *list)
   g_free (list->platform_type);
   g_free (list->threat_entry_type);
   g_free (list->client_state);
-  g_slice_free (EphyGSBThreatList, list);
+  g_free (list);
 }
 
 gboolean
@@ -207,7 +207,7 @@ ephy_gsb_hash_prefix_lookup_new (const guint8 *prefix,
 
   g_assert (prefix);
 
-  lookup = g_slice_new (EphyGSBHashPrefixLookup);
+  lookup = g_new (EphyGSBHashPrefixLookup, 1);
   lookup->prefix = g_bytes_new (prefix, length);
   lookup->negative_expired = negative_expired;
 
@@ -220,7 +220,7 @@ ephy_gsb_hash_prefix_lookup_free (EphyGSBHashPrefixLookup *lookup)
   g_assert (lookup);
 
   g_bytes_unref (lookup->prefix);
-  g_slice_free (EphyGSBHashPrefixLookup, lookup);
+  g_free (lookup);
 }
 
 EphyGSBHashFullLookup *
@@ -237,7 +237,7 @@ ephy_gsb_hash_full_lookup_new (const guint8 *hash,
   g_assert (platform_type);
   g_assert (threat_entry_type);
 
-  lookup = g_slice_new (EphyGSBHashFullLookup);
+  lookup = g_new (EphyGSBHashFullLookup, 1);
   lookup->hash = g_bytes_new (hash, GSB_HASH_SIZE);
   lookup->threat_type = g_strdup (threat_type);
   lookup->platform_type = g_strdup (platform_type);
@@ -256,7 +256,7 @@ ephy_gsb_hash_full_lookup_free (EphyGSBHashFullLookup *lookup)
   g_free (lookup->threat_type);
   g_free (lookup->platform_type);
   g_free (lookup->threat_entry_type);
-  g_slice_free (EphyGSBHashFullLookup, lookup);
+  g_free (lookup);
 }
 
 static JsonObject *
diff --git a/lib/sync/ephy-history-manager.c b/lib/sync/ephy-history-manager.c
index 3983b5a43..31914357d 100644
--- a/lib/sync/ephy-history-manager.c
+++ b/lib/sync/ephy-history-manager.c
@@ -64,7 +64,7 @@ merge_history_async_data_new (EphyHistoryManager                     *manager,
 {
   MergeHistoryAsyncData *data;
 
-  data = g_slice_new (MergeHistoryAsyncData);
+  data = g_new (MergeHistoryAsyncData, 1);
   data->manager = g_object_ref (manager);
   data->is_initial = is_initial;
   data->remotes_deleted = remotes_deleted;
@@ -81,7 +81,7 @@ merge_history_async_data_free (MergeHistoryAsyncData *data)
   g_assert (data);
 
   g_object_unref (data->manager);
-  g_slice_free (MergeHistoryAsyncData, data);
+  g_free (data);
 }
 
 static void
diff --git a/lib/sync/ephy-history-record.c b/lib/sync/ephy-history-record.c
index a600e2654..f0f675deb 100644
--- a/lib/sync/ephy-history-record.c
+++ b/lib/sync/ephy-history-record.c
@@ -64,7 +64,7 @@ ephy_history_record_visit_new (gint64 timestamp,
 {
   EphyHistoryRecordVisit *visit;
 
-  visit = g_slice_new (EphyHistoryRecordVisit);
+  visit = g_new (EphyHistoryRecordVisit, 1);
   visit->timestamp = timestamp;
   visit->type = type;
 
@@ -76,7 +76,7 @@ ephy_history_record_visit_free (EphyHistoryRecordVisit *visit)
 {
   g_assert (visit);
 
-  g_slice_free (EphyHistoryRecordVisit, visit);
+  g_free (visit);
 }
 
 static int
diff --git a/lib/sync/ephy-password-manager.c b/lib/sync/ephy-password-manager.c
index 2335b119d..f088943f9 100644
--- a/lib/sync/ephy-password-manager.c
+++ b/lib/sync/ephy-password-manager.c
@@ -91,7 +91,7 @@ query_async_data_new (EphyPasswordManagerQueryCallback callback,
 {
   QueryAsyncData *data;
 
-  data = g_slice_new (QueryAsyncData);
+  data = g_new (QueryAsyncData, 1);
   data->callback = callback;
   data->user_data = user_data;
 
@@ -103,7 +103,7 @@ query_async_data_free (QueryAsyncData *data)
 {
   g_assert (data);
 
-  g_slice_free (QueryAsyncData, data);
+  g_free (data);
 }
 
 static UpdatePasswordAsyncData *
@@ -112,7 +112,7 @@ update_password_async_data_new (EphyPasswordManager *manager,
 {
   UpdatePasswordAsyncData *data;
 
-  data = g_slice_new (UpdatePasswordAsyncData);
+  data = g_new (UpdatePasswordAsyncData, 1);
   data->manager = g_object_ref (manager);
   data->password = g_strdup (password);
 
@@ -126,7 +126,7 @@ update_password_async_data_free (UpdatePasswordAsyncData *data)
 
   g_object_unref (data->manager);
   g_free (data->password);
-  g_slice_free (UpdatePasswordAsyncData, data);
+  g_free (data);
 }
 
 static MergePasswordsAsyncData *
@@ -139,7 +139,7 @@ merge_passwords_async_data_new (EphyPasswordManager                    *manager,
 {
   MergePasswordsAsyncData *data;
 
-  data = g_slice_new (MergePasswordsAsyncData);
+  data = g_new (MergePasswordsAsyncData, 1);
   data->manager = g_object_ref (manager);
   data->is_initial = is_initial;
   data->remotes_deleted = remotes_deleted;
@@ -156,7 +156,7 @@ merge_passwords_async_data_free (MergePasswordsAsyncData *data)
   g_assert (data);
 
   g_object_unref (data->manager);
-  g_slice_free (MergePasswordsAsyncData, data);
+  g_free (data);
 }
 
 static ManageRecordAsyncData *
@@ -165,7 +165,7 @@ manage_record_async_data_new (EphyPasswordManager *manager,
 {
   ManageRecordAsyncData *data;
 
-  data = g_slice_new (ManageRecordAsyncData);
+  data = g_new (ManageRecordAsyncData, 1);
   data->manager = g_object_ref (manager);
   data->record = g_object_ref (record);
 
@@ -179,7 +179,7 @@ manage_record_async_data_free (ManageRecordAsyncData *data)
 
   g_object_unref (data->manager);
   g_object_unref (data->record);
-  g_slice_free (ManageRecordAsyncData, data);
+  g_free (data);
 }
 
 static GHashTable *
diff --git a/lib/sync/ephy-sync-crypto.c b/lib/sync/ephy-sync-crypto.c
index bfc899cdf..6289a6001 100644
--- a/lib/sync/ephy-sync-crypto.c
+++ b/lib/sync/ephy-sync-crypto.c
@@ -53,7 +53,7 @@ ephy_sync_crypto_hawk_options_new (const char *app,
 {
   SyncCryptoHawkOptions *options;
 
-  options = g_slice_new (SyncCryptoHawkOptions);
+  options = g_new (SyncCryptoHawkOptions, 1);
   options->app = g_strdup (app);
   options->dlg = g_strdup (dlg);
   options->ext = g_strdup (ext);
@@ -82,7 +82,7 @@ ephy_sync_crypto_hawk_options_free (SyncCryptoHawkOptions *options)
   g_free (options->payload);
   g_free (options->timestamp);
 
-  g_slice_free (SyncCryptoHawkOptions, options);
+  g_free (options);
 }
 
 static SyncCryptoHawkArtifacts *
@@ -99,7 +99,7 @@ ephy_sync_crypto_hawk_artifacts_new (const char *app,
 {
   SyncCryptoHawkArtifacts *artifacts;
 
-  artifacts = g_slice_new (SyncCryptoHawkArtifacts);
+  artifacts = g_new (SyncCryptoHawkArtifacts, 1);
   artifacts->app = g_strdup (app);
   artifacts->dlg = g_strdup (dlg);
   artifacts->ext = g_strdup (ext);
@@ -130,7 +130,7 @@ ephy_sync_crypto_hawk_artifacts_free (SyncCryptoHawkArtifacts *artifacts)
   g_free (artifacts->resource);
   g_free (artifacts->ts);
 
-  g_slice_free (SyncCryptoHawkArtifacts, artifacts);
+  g_free (artifacts);
 }
 
 static char *
@@ -383,7 +383,7 @@ ephy_sync_crypto_hawk_header_new (const char            *url,
       header = hawk_append_to_header (header, "dlg", artifacts->dlg);
   }
 
-  hawk_header = g_slice_new (SyncCryptoHawkHeader);
+  hawk_header = g_new (SyncCryptoHawkHeader, 1);
   hawk_header->header = g_strdup (header);
   hawk_header->artifacts = artifacts;
 
@@ -405,7 +405,7 @@ ephy_sync_crypto_hawk_header_free (SyncCryptoHawkHeader *header)
   g_free (header->header);
   ephy_sync_crypto_hawk_artifacts_free (header->artifacts);
 
-  g_slice_free (SyncCryptoHawkHeader, header);
+  g_free (header);
 }
 
 SyncCryptoRSAKeyPair *
@@ -429,7 +429,7 @@ ephy_sync_crypto_rsa_key_pair_new (void)
   /* Given correct parameters, this never fails. */
   g_assert (success);
 
-  key_pair = g_slice_new (SyncCryptoRSAKeyPair);
+  key_pair = g_new (SyncCryptoRSAKeyPair, 1);
   key_pair->public = public;
   key_pair->private = private;
 
@@ -444,7 +444,7 @@ ephy_sync_crypto_rsa_key_pair_free (SyncCryptoRSAKeyPair *key_pair)
   rsa_public_key_clear (&key_pair->public);
   rsa_private_key_clear (&key_pair->private);
 
-  g_slice_free (SyncCryptoRSAKeyPair, key_pair);
+  g_free (key_pair);
 }
 
 SyncCryptoKeyBundle *
@@ -465,7 +465,7 @@ ephy_sync_crypto_key_bundle_new (const char *aes_key_b64,
   hmac_key = g_base64_decode (hmac_key_b64, &hmac_key_len);
   g_assert (hmac_key_len == 32);
 
-  bundle = g_slice_new (SyncCryptoKeyBundle);
+  bundle = g_new (SyncCryptoKeyBundle, 1);
   bundle->aes_key_hex = ephy_sync_utils_encode_hex (aes_key, aes_key_len);
   bundle->hmac_key_hex = ephy_sync_utils_encode_hex (hmac_key, hmac_key_len);
 
@@ -483,7 +483,7 @@ ephy_sync_crypto_key_bundle_free (SyncCryptoKeyBundle *bundle)
   g_free (bundle->aes_key_hex);
   g_free (bundle->hmac_key_hex);
 
-  g_slice_free (SyncCryptoKeyBundle, bundle);
+  g_free (bundle);
 }
 
 static char *
@@ -855,7 +855,7 @@ ephy_sync_crypto_derive_master_bundle (const guint8 *key)
                                           prk, len,
                                           tmp, len + strlen (info) + 1);
 
-  bundle = g_slice_new (SyncCryptoKeyBundle);
+  bundle = g_new (SyncCryptoKeyBundle, 1);
   bundle->aes_key_hex = g_strdup (aes_key_hex);
   bundle->hmac_key_hex = g_strdup (hmac_key_hex);
 
diff --git a/lib/sync/ephy-sync-service.c b/lib/sync/ephy-sync-service.c
index cbcb61aa8..24c97ac19 100644
--- a/lib/sync/ephy-sync-service.c
+++ b/lib/sync/ephy-sync-service.c
@@ -154,7 +154,7 @@ storage_request_async_data_new (const char          *endpoint,
 {
   StorageRequestAsyncData *data;
 
-  data = g_slice_new (StorageRequestAsyncData);
+  data = g_new (StorageRequestAsyncData, 1);
   data->endpoint = g_strdup (endpoint);
   data->method = g_strdup (method);
   data->request_body = g_strdup (request_body);
@@ -174,7 +174,7 @@ storage_request_async_data_free (StorageRequestAsyncData *data)
   g_free (data->endpoint);
   g_free (data->method);
   g_free (data->request_body);
-  g_slice_free (StorageRequestAsyncData, data);
+  g_free (data);
 }
 
 static SignInAsyncData *
@@ -190,7 +190,7 @@ sign_in_async_data_new (EphySyncService *service,
 {
   SignInAsyncData *data;
 
-  data = g_slice_new (SignInAsyncData);
+  data = g_new (SignInAsyncData, 1);
   data->service = g_object_ref (service);
   data->email = g_strdup (email);
   data->uid = g_strdup (uid);
@@ -221,7 +221,7 @@ sign_in_async_data_free (SignInAsyncData *data)
   g_free (data->req_hmac_key);
   g_free (data->resp_hmac_key);
   g_free (data->resp_xor_key);
-  g_slice_free (SignInAsyncData, data);
+  g_free (data);
 }
 
 static SyncCollectionAsyncData *
@@ -232,7 +232,7 @@ sync_collection_async_data_new (EphySyncService           *service,
 {
   SyncCollectionAsyncData *data;
 
-  data = g_slice_new (SyncCollectionAsyncData);
+  data = g_new (SyncCollectionAsyncData, 1);
   data->service = g_object_ref (service);
   data->manager = g_object_ref (manager);
   data->is_initial = is_initial;
@@ -252,7 +252,7 @@ sync_collection_async_data_free (SyncCollectionAsyncData *data)
   g_object_unref (data->manager);
   g_list_free_full (data->remotes_deleted, g_object_unref);
   g_list_free_full (data->remotes_updated, g_object_unref);
-  g_slice_free (SyncCollectionAsyncData, data);
+  g_free (data);
 }
 
 static SyncAsyncData *
@@ -262,7 +262,7 @@ sync_async_data_new (EphySyncService           *service,
 {
   SyncAsyncData *data;
 
-  data = g_slice_new (SyncAsyncData);
+  data = g_new (SyncAsyncData, 1);
   data->service = g_object_ref (service);
   data->manager = g_object_ref (manager);
   data->synchronizable = g_object_ref (synchronizable);
@@ -278,7 +278,7 @@ sync_async_data_free (SyncAsyncData *data)
   g_object_unref (data->service);
   g_object_unref (data->manager);
   g_object_unref (data->synchronizable);
-  g_slice_free (SyncAsyncData, data);
+  g_free (data);
 }
 
 static inline BatchUploadAsyncData *
@@ -293,7 +293,7 @@ batch_upload_async_data_new (EphySyncService           *service,
 {
   BatchUploadAsyncData *data;
 
-  data = g_slice_new (BatchUploadAsyncData);
+  data = g_new (BatchUploadAsyncData, 1);
   data->service = g_object_ref (service);
   data->manager = g_object_ref (manager);
   data->synchronizables = g_ptr_array_ref (synchronizables);
@@ -326,7 +326,7 @@ batch_upload_async_data_free (BatchUploadAsyncData *data)
   g_object_unref (data->manager);
   g_ptr_array_unref (data->synchronizables);
   g_free (data->batch_id);
-  g_slice_free (BatchUploadAsyncData, data);
+  g_free (data);
 }
 
 static void
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index b1e1b5116..1b1672a33 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -858,7 +858,7 @@ free_prefetch_helper (PrefetchHelper *helper)
 {
   soup_uri_free (helper->uri);
   g_object_unref (helper->entry);
-  g_slice_free (PrefetchHelper, helper);
+  g_free (helper);
 }
 
 static gboolean
@@ -889,7 +889,7 @@ schedule_dns_prefetch (EphyLocationEntry *entry, guint interval, const gchar *ur
   if (entry->dns_prefetch_handler)
     g_source_remove (entry->dns_prefetch_handler);
 
-  helper = g_slice_new0 (PrefetchHelper);
+  helper = g_new0 (PrefetchHelper, 1);
   helper->entry = g_object_ref (entry);
   helper->uri = uri;
 
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 532930e05..3c35139e5 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -146,7 +146,7 @@ notebook_tracker_set_notebook (NotebookTracker *tracker,
 static NotebookTracker *
 notebook_tracker_new (EphyNotebook *notebook)
 {
-  NotebookTracker *tracker = g_slice_new0 (NotebookTracker);
+  NotebookTracker *tracker = g_new0 (NotebookTracker, 1);
 
   tracker->ref_count = 1;
   notebook_tracker_set_notebook (tracker, notebook);
@@ -169,7 +169,7 @@ notebook_tracker_unref (NotebookTracker *tracker)
     return;
 
   notebook_tracker_set_notebook (tracker, NULL);
-  g_slice_free (NotebookTracker, tracker);
+  g_free (tracker);
 }
 
 static EphyNotebook *
@@ -199,7 +199,7 @@ closed_tab_free (ClosedTab *tab)
   notebook_tracker_unref (tab->notebook_tracker);
   webkit_web_view_session_state_unref (tab->state);
 
-  g_slice_free (ClosedTab, tab);
+  g_free (tab);
 }
 
 static ClosedTab *
@@ -207,7 +207,7 @@ closed_tab_new (EphyWebView     *web_view,
                 int              position,
                 NotebookTracker *notebook_tracker)
 {
-  ClosedTab *tab = g_slice_new0 (ClosedTab);
+  ClosedTab *tab = g_new0 (ClosedTab, 1);
 
   tab->url = g_strdup (ephy_web_view_get_address (web_view));
   tab->position = position;
@@ -557,7 +557,7 @@ session_tab_new (EphyEmbed   *embed,
   EphyWebView *web_view = ephy_embed_get_web_view (embed);
   EphyWebViewErrorPage error_page = ephy_web_view_get_error_page (web_view);
 
-  session_tab = g_slice_new (SessionTab);
+  session_tab = g_new (SessionTab, 1);
 
   address = ephy_web_view_get_address (web_view);
   /* Do not store ephy-about: URIs, they are not valid for loading. */
@@ -590,7 +590,7 @@ session_tab_free (SessionTab *tab)
   g_free (tab->title);
   g_clear_pointer (&tab->state, webkit_web_view_session_state_unref);
 
-  g_slice_free (SessionTab, tab);
+  g_free (tab);
 }
 
 typedef struct {
@@ -617,7 +617,7 @@ session_window_new (EphyWindow  *window,
     return NULL;
   }
 
-  session_window = g_slice_new0 (SessionWindow);
+  session_window = g_new0 (SessionWindow, 1);
   get_window_geometry (GTK_WINDOW (window), &session_window->geometry);
   session_window->role = g_strdup (gtk_window_get_role (GTK_WINDOW (window)));
 
@@ -642,7 +642,7 @@ session_window_free (SessionWindow *session_window)
   g_free (session_window->role);
   g_list_free_full (session_window->tabs, (GDestroyNotify)session_tab_free);
 
-  g_slice_free (SessionWindow, session_window);
+  g_free (session_window);
 }
 
 typedef struct {
@@ -658,7 +658,7 @@ save_data_new (EphySession *session)
   EphyShell *shell = ephy_shell_get_default ();
   GList *windows, *w;
 
-  data = g_slice_new0 (SaveData);
+  data = g_new0 (SaveData, 1);
   data->session = g_object_ref (session);
 
   windows = gtk_application_get_windows (GTK_APPLICATION (shell));
@@ -681,7 +681,7 @@ save_data_free (SaveData *data)
 
   g_object_unref (data->session);
 
-  g_slice_free (SaveData, data);
+  g_free (data);
 }
 
 static int
@@ -1068,7 +1068,7 @@ session_parser_context_new (EphySession *session,
 {
   SessionParserContext *context;
 
-  context = g_slice_new0 (SessionParserContext);
+  context = g_new0 (SessionParserContext, 1);
   context->session = g_object_ref (session);
   context->user_time = user_time;
   context->is_first_window = TRUE;
@@ -1081,7 +1081,7 @@ session_parser_context_free (SessionParserContext *context)
 {
   g_object_unref (context->session);
 
-  g_slice_free (SessionParserContext, context);
+  g_free (context);
 }
 
 static void
@@ -1288,7 +1288,7 @@ load_from_stream_async_data_new (GMarkupParseContext *parser)
 {
   LoadFromStreamAsyncData *data;
 
-  data = g_slice_new (LoadFromStreamAsyncData);
+  data = g_new (LoadFromStreamAsyncData, 1);
   data->shell = g_object_ref (ephy_shell_get_default ());
   data->parser = parser;
 
@@ -1301,7 +1301,7 @@ load_from_stream_async_data_free (LoadFromStreamAsyncData *data)
   g_object_unref (data->shell);
   g_markup_parse_context_free (data->parser);
 
-  g_slice_free (LoadFromStreamAsyncData, data);
+  g_free (data);
 }
 
 static void
@@ -1471,7 +1471,7 @@ load_async_data_new (guint32 user_time)
 {
   LoadAsyncData *data;
 
-  data = g_slice_new (LoadAsyncData);
+  data = g_new (LoadAsyncData, 1);
   data->user_time = user_time;
 
   return data;
@@ -1480,7 +1480,7 @@ load_async_data_new (guint32 user_time)
 static void
 load_async_data_free (LoadAsyncData *data)
 {
-  g_slice_free (LoadAsyncData, data);
+  g_free (data);
 }
 
 static void
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 8b9c2a19e..c6b3c2be2 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -94,7 +94,7 @@ ephy_shell_startup_context_new (EphyStartupFlags startup_flags,
                                 char **arguments,
                                 guint32 user_time)
 {
-  EphyShellStartupContext *ctx = g_slice_new0 (EphyShellStartupContext);
+  EphyShellStartupContext *ctx = g_new0 (EphyShellStartupContext, 1);
 
   ctx->startup_flags = startup_flags;
 
@@ -120,7 +120,7 @@ ephy_shell_startup_context_free (EphyShellStartupContext *ctx)
 
   g_strfreev (ctx->arguments);
 
-  g_slice_free (EphyShellStartupContext, ctx);
+  g_free (ctx);
 }
 
 static void
@@ -579,7 +579,7 @@ ephy_shell_before_emit (GApplication *application,
   g_variant_iter_init (&iter, platform_data);
   while (g_variant_iter_loop (&iter, "{&sv}", &key, &value)) {
     if (strcmp (key, "ephy-shell-startup-context") == 0) {
-      ctx = g_slice_new0 (EphyShellStartupContext);
+      ctx = g_new0 (EphyShellStartupContext, 1);
 
       /*
        * Iterate over the startup context variant and fill the members
@@ -1109,7 +1109,7 @@ open_uris_data_new (EphyShell       *shell,
   gboolean have_uris;
   EphySession *session = ephy_shell_get_session (shell);
 
-  data = g_slice_new0 (OpenURIsData);
+  data = g_new0 (OpenURIsData, 1);
   data->shell = shell;
   data->session = session ? g_object_ref (session) : NULL;
   data->uris = g_strdupv ((char **)uris);
@@ -1143,8 +1143,7 @@ open_uris_data_free (OpenURIsData *data)
   g_application_release (G_APPLICATION (data->shell));
   g_clear_object (&data->session);
   g_strfreev (data->uris);
-
-  g_slice_free (OpenURIsData, data);
+  g_free (data);
 }
 
 static gboolean
diff --git a/src/ephy-window.c b/src/ephy-window.c
index b6f25f977..533d26c88 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1904,7 +1904,7 @@ verify_url_async_data_new (EphyWindow               *window,
                            WebKitPolicyDecisionType  decision_type,
                            const char               *request_uri)
 {
-  VerifyUrlAsyncData *data = g_slice_new (VerifyUrlAsyncData);
+  VerifyUrlAsyncData *data = g_new (VerifyUrlAsyncData, 1);
 
   data->window = g_object_ref (window);
   data->web_view = g_object_ref (web_view);
@@ -1922,7 +1922,7 @@ verify_url_async_data_free (VerifyUrlAsyncData *data)
   g_object_unref (data->web_view);
   g_object_unref (data->decision);
   g_free (data->request_uri);
-  g_slice_free (VerifyUrlAsyncData, data);
+  g_free (data);
 }
 
 static gboolean
@@ -3720,7 +3720,7 @@ modified_forms_data_free (ModifiedFormsData *data)
 {
   g_object_unref (data->cancellable);
 
-  g_slice_free (ModifiedFormsData, data);
+  g_free (data);
 }
 
 static void
@@ -3791,7 +3791,7 @@ ephy_window_check_modified_forms (EphyWindow *window)
 
   window->checking_modified_forms = TRUE;
 
-  data = g_slice_new0 (ModifiedFormsData);
+  data = g_new0 (ModifiedFormsData, 1);
   data->window = window;
   data->cancellable = g_cancellable_new ();
   data->embeds_to_check = gtk_notebook_get_n_pages (window->notebook);
diff --git a/src/synced-tabs-dialog.c b/src/synced-tabs-dialog.c
index 90d7ea21e..c21c42188 100644
--- a/src/synced-tabs-dialog.c
+++ b/src/synced-tabs-dialog.c
@@ -74,7 +74,7 @@ populate_row_async_data_new (SyncedTabsDialog *dialog,
 {
   PopulateRowAsyncData *data;
 
-  data = g_slice_new (PopulateRowAsyncData);
+  data = g_new (PopulateRowAsyncData, 1);
   data->dialog = g_object_ref (dialog);
   data->title = g_strdup (title);
   data->url = g_strdup (url);
@@ -89,7 +89,7 @@ populate_row_async_data_free (PopulateRowAsyncData *data)
   g_object_unref (data->dialog);
   g_free (data->title);
   g_free (data->url);
-  g_slice_free (PopulateRowAsyncData, data);
+  g_free (data);
 }
 
 static void
diff --git a/src/window-commands.c b/src/window-commands.c
index 9b82fc6c6..ea0fddcea 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -897,7 +897,7 @@ static void
 ephy_application_dialog_data_free (EphyApplicationDialogData *data)
 {
   g_free (data->icon_href);
-  g_slice_free (EphyApplicationDialogData, data);
+  g_free (data);
 }
 
 static void
@@ -1390,7 +1390,7 @@ window_cmd_save_as_application (GSimpleAction *action,
   context = gtk_widget_get_style_context (label);
   gtk_style_context_add_class (context, "dim-label");
 
-  data = g_slice_new0 (EphyApplicationDialogData);
+  data = g_new0 (EphyApplicationDialogData, 1);
   data->view = view;
   data->image = image;
   data->entry = entry;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]