[anjal] Fix compiler warning and a possible crash



commit a220e75b536e769d1b4def6eb5ef7320da66b4ba
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Mon Jul 20 12:50:09 2009 +0530

    Fix compiler warning and a possible crash

 src/em-webkit-stream.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/em-webkit-stream.c b/src/em-webkit-stream.c
index 01f5b21..ddffc28 100644
--- a/src/em-webkit-stream.c
+++ b/src/em-webkit-stream.c
@@ -38,6 +38,7 @@ static void em_webkit_stream_finalize (CamelObject *object);
 static ssize_t emws_sync_write(CamelStream *stream, const char *buffer, size_t n);
 static int emws_sync_close(CamelStream *stream);
 static int emws_sync_flush(CamelStream *stream);
+static void emws_weak_notify (EMWebKitStream *emws, GObject *view);
 
 static EMSyncStreamClass *parent_class = NULL;
 
@@ -88,6 +89,8 @@ em_webkit_stream_finalize (CamelObject *object)
 {
 	EMWebKitStream *emws = (EMWebKitStream *)object;
 
+	if (emws->view)
+		g_object_weak_unref ((GObject *)emws->view, (GWeakNotify)emws_weak_notify, object);
 	g_string_free (emws->buffer, TRUE);
 	camel_stream_close((CamelStream *)emws);
 }
@@ -138,7 +141,7 @@ em_webkit_stream_new(WebKitWebView *view, GtkWidget *body)
 	new->body = body;
 	em_sync_stream_set_buffer_size(&new->sync, 8192);
 
-	g_object_weak_ref (view, emws_weak_notify, new);
+	g_object_weak_ref ((GObject *)view, (GWeakNotify)emws_weak_notify, new);
 
 	return (CamelStream *)new;
 }



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