cpw.nader.asynclogging-3: b63717ee: Updated commonlog.c to use more consiste...
morshed.nader at gmail.com
morshed.nader at gmail.com
Thu Jan 5 19:31:06 EST 2012
----------------------------------------------------------------------
Revision: b63717eedda0714bbc0902b493001bf582ae7da4
Parent: f03e349511d408f28f64610504936abe0b272c80
Author: morshed.nader at gmail.com
Date: 01/05/12 11:27:48
Branch: im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/b63717eedda0714bbc0902b493001bf582ae7da4
Changelog:
Updated commonlog.c to use more consistent variable names
Fixed reads segfaulting due to the GCancellable object not being ref'd when it should have
Changes against parent f03e349511d408f28f64610504936abe0b272c80
patched libpurple/commonlog.c
-------------- next part --------------
============================================================
--- libpurple/commonlog.c b760c69be1d2591fff088ae10133dfc5159b656e
+++ libpurple/commonlog.c 748c7b8ab45b1bac8b342466227efdb37480d701
@@ -569,7 +569,7 @@ purple_common_log_create_async(PurpleLog
if (purple_common_log_get_path(PURPLE_COMMON_LOG(log)) == NULL) {
gchar *dir, *new_path;
- create_callback_data *callback_data;
+ create_callback_data *data;
/* This log is new */
dir = purple_log_get_log_dir(purple_log_get_chat_type(log),
@@ -599,15 +599,15 @@ purple_common_log_create_async(PurpleLog
g_free(dir);
/* Create the file */
- callback_data = g_new(create_callback_data, 1);
- callback_data->log = g_object_ref(log);
- callback_data->cancel = cancellable;
- callback_data->cb = cb;
- callback_data->userdata = userdata;
- callback_data->path = new_path;
+ data = g_new(create_callback_data, 1);
+ data->log = g_object_ref(log);
+ data->cancel = g_object_ref(cancellable);
+ data->cb = cb;
+ data->userdata = userdata;
+ data->path = new_path;
g_idle_add_full(io_priority, purple_common_log_create_async_2,
- callback_data, create_callback_data_free);
+ data, create_callback_data_free);
} else
SIMPLE_ASYNC_RESULT_NEW_GOOD(log, cb, userdata,
purple_common_log_create_async,
@@ -620,24 +620,23 @@ purple_common_log_create_async_2(gpointe
/* Loop creation until we stop getting EWOULDBLOCK */
GError *err = NULL;
gint socket;
- create_callback_data *callback_data = userdata;
+ create_callback_data *data = userdata;
- if (g_cancellable_set_error_if_cancelled(callback_data->cancel, &err)) {
- SIMPLE_ASYNC_RESULT_FROM_ERROR(callback_data->log,
- callback_data->cb, callback_data->userdata, err);
+ if (g_cancellable_set_error_if_cancelled(data->cancel, &err)) {
+ SIMPLE_ASYNC_RESULT_FROM_ERROR(data->log,
+ data->cb, data->userdata, err);
return FALSE;
}
- socket = g_open(callback_data->path, O_CREAT | O_RDWR | O_NONBLOCK,
+ socket = g_open(data->path, O_CREAT | O_RDWR | O_NONBLOCK,
S_IRUSR | S_IWUSR);
if (socket < 0) {
if (errno == EWOULDBLOCK)
return TRUE;
- SIMPLE_ASYNC_RESULT_FROM_NEW_ERROR(callback_data->log,
- callback_data->cb, callback_data->userdata,
+ SIMPLE_ASYNC_RESULT_FROM_NEW_ERROR(data->log, data->cb, data->userdata,
G_IO_ERROR,
g_file_error_from_errno(errno),
"%s", g_strerror(errno));
@@ -645,11 +644,11 @@ purple_common_log_create_async_2(gpointe
return FALSE;
}
- purple_common_log_set_socket(callback_data->log, socket);
- purple_common_log_set_path(callback_data->log, callback_data->path);
+ purple_common_log_set_socket(data->log, socket);
+ purple_common_log_set_path(data->log, data->path);
- SIMPLE_ASYNC_RESULT_NEW_GOOD(callback_data->log, callback_data->cb,
- callback_data->userdata, purple_common_log_create_async,
+ SIMPLE_ASYNC_RESULT_NEW_GOOD(data->log, data->cb,
+ data->userdata, purple_common_log_create_async,
g_simple_async_result_set_op_res_gboolean(simple, TRUE));
return FALSE;
@@ -708,10 +707,10 @@ purple_common_log_read_async(PurpleLog *
SIMPLE_ASYNC_RESULT_FROM_ERROR(log, cb, userdata, err);
return;
}
-
+
data = g_new(read_callback_data, 1);
data->log = g_object_ref(log);
- data->cancel = cancellable;
+ data->cancel = g_object_ref(cancellable);
data->cb = cb;
data->userdata = userdata;
data->contents = NULL;
More information about the Commits
mailing list