glib r7864 - trunk/gio
- From: ryanl svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7864 - trunk/gio
- Date: Mon, 16 Feb 2009 09:33:39 +0000 (UTC)
Author: ryanl
Date: Mon Feb 16 09:33:39 2009
New Revision: 7864
URL: http://svn.gnome.org/viewvc/glib?rev=7864&view=rev
Log:
2009-02-16 Ryan Lortie <desrt desrt ca>
Bug 571598 â GAsyncResult with NULL gobject
* gsimpleasyncresult.c: remove various assertions and add some checks
to allow for a NULL source_object in GSimpleAsyncResult.
Modified:
trunk/gio/ChangeLog
trunk/gio/gsimpleasyncresult.c
Modified: trunk/gio/gsimpleasyncresult.c
==============================================================================
--- trunk/gio/gsimpleasyncresult.c (original)
+++ trunk/gio/gsimpleasyncresult.c Mon Feb 16 09:33:39 2009
@@ -179,7 +179,8 @@
/**
* g_simple_async_result_new:
- * @source_object: a #GObject the asynchronous function was called with.
+ * @source_object: a #GObject the asynchronous function was called with,
+ * or %NULL.
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
* @source_tag: the asynchronous function.
@@ -196,11 +197,14 @@
{
GSimpleAsyncResult *simple;
- g_return_val_if_fail (G_IS_OBJECT (source_object), NULL);
+ g_return_val_if_fail (!source_object || G_IS_OBJECT (source_object), NULL);
simple = g_object_new (G_TYPE_SIMPLE_ASYNC_RESULT, NULL);
simple->callback = callback;
- simple->source_object = g_object_ref (source_object);
+ if (source_object)
+ simple->source_object = g_object_ref (source_object);
+ else
+ simple->source_object = NULL;
simple->user_data = user_data;
simple->source_tag = source_tag;
@@ -209,7 +213,7 @@
/**
* g_simple_async_result_new_from_error:
- * @source_object: a #GObject.
+ * @source_object: a #GObject, or %NULL.
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
* @error: a #GError location.
@@ -226,7 +230,7 @@
{
GSimpleAsyncResult *simple;
- g_return_val_if_fail (G_IS_OBJECT (source_object), NULL);
+ g_return_val_if_fail (!source_object || G_IS_OBJECT (source_object), NULL);
simple = g_simple_async_result_new (source_object,
callback,
@@ -238,7 +242,7 @@
/**
* g_simple_async_result_new_error:
- * @source_object: a #GObject.
+ * @source_object: a #GObject, or %NULL.
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
* @domain: a #GQuark.
@@ -262,7 +266,7 @@
GSimpleAsyncResult *simple;
va_list args;
- g_return_val_if_fail (G_IS_OBJECT (source_object), NULL);
+ g_return_val_if_fail (!source_object || G_IS_OBJECT (source_object), NULL);
g_return_val_if_fail (domain != 0, NULL);
g_return_val_if_fail (format != NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]