[libgda] Avoid calling g_main_context_unref(NULL)
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Avoid calling g_main_context_unref(NULL)
- Date: Sun, 18 May 2014 21:40:07 +0000 (UTC)
commit d5146ee49e704fa4f63394a1310242913e6ae2b3
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun May 18 23:38:26 2014 +0200
Avoid calling g_main_context_unref(NULL)
libgda/gda-blob-op.c | 12 ++++++++----
libgda/gda-data-select.c | 18 ++++++++++++------
2 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/libgda/gda-blob-op.c b/libgda/gda-blob-op.c
index 004328b..b4b367a 100644
--- a/libgda/gda-blob-op.c
+++ b/libgda/gda-blob-op.c
@@ -232,7 +232,8 @@ gda_blob_op_get_length (GdaBlobOp *op)
gpointer callval;
gda_worker_do_job (op->priv->worker, context, 0, &callval, NULL,
(GdaWorkerFunc) worker_get_length, (gpointer) &data, NULL, NULL, NULL);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
gda_lockable_unlock ((GdaLockable*) op->priv->cnc); /* CNC UNLOCK */
@@ -297,7 +298,8 @@ gda_blob_op_read (GdaBlobOp *op, GdaBlob *blob, glong offset, glong size)
gpointer callval;
gda_worker_do_job (op->priv->worker, context, 0, &callval, NULL,
(GdaWorkerFunc) worker_read, (gpointer) &data, NULL, NULL, NULL);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
gda_lockable_unlock ((GdaLockable*) op->priv->cnc); /* CNC UNLOCK */
@@ -387,7 +389,8 @@ gda_blob_op_write (GdaBlobOp *op, GdaBlob *blob, glong offset)
gpointer callval;
gda_worker_do_job (op->priv->worker, context, 0, &callval, NULL,
(GdaWorkerFunc) worker_write, (gpointer) &data, NULL, NULL, NULL);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
gda_lockable_unlock ((GdaLockable*) op->priv->cnc); /* CNC UNLOCK */
@@ -449,7 +452,8 @@ gda_blob_op_write_all (GdaBlobOp *op, GdaBlob *blob)
gpointer callval;
gda_worker_do_job (op->priv->worker, context, 0, &callval, NULL,
(GdaWorkerFunc) worker_write_all, (gpointer) &data, NULL, NULL,
NULL);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
gda_lockable_unlock ((GdaLockable*) op->priv->cnc); /* CNC UNLOCK */
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index 674129d..47d1c8d 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -3913,7 +3913,8 @@ _gda_data_select_fetch_nb_rows (GdaDataSelect *model)
nbrows = *result;
g_slice_free (gint, result);
}
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
return nbrows;
}
@@ -3952,7 +3953,8 @@ _gda_data_select_fetch_random (GdaDataSelect *model, GdaRow **prow, gint rownum
gpointer result;
gda_worker_do_job (model->priv->worker, context, 0, &result, NULL,
(GdaWorkerFunc) worker_fetch_random, &jdata, NULL, NULL, error);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
return result ? TRUE : FALSE;
}
@@ -3979,7 +3981,8 @@ _gda_data_select_store_all (GdaDataSelect *model, GError **error)
gpointer result;
gda_worker_do_job (model->priv->worker, context, 0, (gpointer) &result, NULL,
(GdaWorkerFunc) worker_store_all, model, NULL, NULL, NULL);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
return result ? TRUE : FALSE;
}
@@ -4011,7 +4014,8 @@ _gda_data_select_fetch_next (GdaDataSelect *model, GdaRow **prow, gint rownum
gpointer result;
gda_worker_do_job (model->priv->worker, context, 0, &result, NULL,
(GdaWorkerFunc) worker_fetch_next, &jdata, NULL, NULL, error);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
return result ? TRUE : FALSE;
}
@@ -4043,7 +4047,8 @@ _gda_data_select_fetch_prev (GdaDataSelect *model, GdaRow **prow, gint rownum
gpointer result;
gda_worker_do_job (model->priv->worker, context, 0, &result, NULL,
(GdaWorkerFunc) worker_fetch_prev, &jdata, NULL, NULL, error);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
return result ? TRUE : FALSE;
}
@@ -4075,6 +4080,7 @@ _gda_data_select_fetch_at (GdaDataSelect *model, GdaRow **prow, gint rownum
gpointer result;
gda_worker_do_job (model->priv->worker, context, 0, &result, NULL,
(GdaWorkerFunc) worker_fetch_at, &jdata, NULL, NULL, error);
- g_main_context_unref (context);
+ if (context)
+ g_main_context_unref (context);
return result ? TRUE : FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]