/pidgin/main: 8ca83abbc248: Fix some crashes and bugs introduced...

Tomasz Wasilczyk twasilczyk at pidgin.im
Tue Feb 11 14:08:40 EST 2014


Changeset: 8ca83abbc2482de2548af6c68fefaa2b7f3a65b7
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-02-11 20:08 +0100
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/8ca83abbc248

Description:

Fix some crashes and bugs introduced by recent deprecation fixes

diffstat:

 pidgin/gtkconv.c      |   3 +++
 pidgin/gtkmenutray.c  |  10 +++++-----
 pidgin/gtkstatusbox.c |   6 ++++++
 pidgin/gtkutils.c     |   5 +++++
 4 files changed, 19 insertions(+), 5 deletions(-)

diffs (75 lines):

diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -230,6 +230,9 @@ static const GdkColor *get_nick_color(Pi
 	float scale;
 
 	col = g_array_index(gtkconv->nick_colors, GdkColor, g_str_hash(name) % gtkconv->nick_colors->len);
+
+	g_return_val_if_fail(style != NULL, &col);
+
 #if GTK_CHECK_VERSION(3,0,0)
 	gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &rgba);
 	scale = (1 - LUMINANCE(rgba)) * ((float)0xffff / MAX(MAX(col.red, col.blue), col.green));
diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c
--- a/pidgin/gtkmenutray.c
+++ b/pidgin/gtkmenutray.c
@@ -23,6 +23,7 @@
 
 #include "gtkmenutray.h"
 
+#include "glibcompat.h"
 #include "gtk3compat.h"
 
 /******************************************************************************
@@ -155,12 +156,11 @@ pidgin_menu_tray_init(PidginMenuTray *me
 	GtkSettings *settings;
 	gint height = -1;
 
-#if GTK_CHECK_VERSION(3,0,0)
-	gtk_widget_set_hexpand(widget, TRUE);
-	gtk_widget_set_halign(widget, GTK_ALIGN_END);
-#else
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+	/* Gtk3 docs says, it should be replaced with gtk_widget_set_hexpand and
+	 * gtk_widget_set_halign. But it doesn't seems to work. */
 	gtk_menu_item_set_right_justified(GTK_MENU_ITEM(menu_tray), TRUE);
-#endif
+G_GNUC_END_IGNORE_DEPRECATIONS
 
 	if(!GTK_IS_WIDGET(menu_tray->tray))
 		menu_tray->tray = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c
--- a/pidgin/gtkstatusbox.c
+++ b/pidgin/gtkstatusbox.c
@@ -455,8 +455,14 @@ destroy_icon_box(PidginStatusBox *status
 		return;
 
 	gtk_widget_destroy(statusbox->icon_box);
+
+#if GTK_CHECK_VERSION(3,0,0)
 	g_object_unref(statusbox->hand_cursor);
 	g_object_unref(statusbox->arrow_cursor);
+#else
+	gdk_cursor_unref(statusbox->hand_cursor);
+	gdk_cursor_unref(statusbox->arrow_cursor);
+#endif
 
 	purple_imgstore_unref(statusbox->buddy_icon_img);
 
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -2118,7 +2118,12 @@ void pidgin_set_cursor(GtkWidget *widget
 
 	cursor = gdk_cursor_new(cursor_type);
 	gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
+
+#if GTK_CHECK_VERSION(3,0,0)
 	g_object_unref(cursor);
+#else
+	gdk_cursor_unref(cursor);
+#endif
 
 	gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget)));
 }



More information about the Commits mailing list