[GnomeMeeting-devel-list] [PATCH] checking pixbufs before use



Hi,

the following adds a few tests where gnomemeeting tries to load pixbufs, then uses them unconditionnally.

Won't fix my win32 problems (where pixbufs aren't found because the paths are wrong...), but will make harmless warnings go away.

Needs a quick reread before applying.

Snark

PS: now I'm left with the GmStatusbar not working on win32...
diff -ur gnomemeeting-opal/src/callbacks.cpp gnomemeeting/src/callbacks.cpp
--- gnomemeeting-opal/src/callbacks.cpp	2005-11-30 08:38:20.000000000 +0100
+++ gnomemeeting/src/callbacks.cpp	2005-12-04 09:41:58.000000000 +0100
@@ -193,7 +193,8 @@
                           "Damien Sandras <dsandras seconix com>",
 			  pixbuf);
 
-  g_object_unref (pixbuf);
+  if (pixbuf)
+    g_object_unref (pixbuf);
 
   gtk_window_set_transient_for (GTK_WINDOW (abox), GTK_WINDOW (parent_window));
   gtk_window_present (GTK_WINDOW (abox));
diff -ur gnomemeeting-opal/src/chat_window.cpp gnomemeeting/src/chat_window.cpp
--- gnomemeeting-opal/src/chat_window.cpp	2005-12-03 20:56:07.000000000 +0100
+++ gnomemeeting/src/chat_window.cpp	2005-12-04 09:39:01.000000000 +0100
@@ -989,11 +989,16 @@
 			  g_strdup ("chat_window"), g_free);
   
   gtk_window_set_title (GTK_WINDOW (chat_window), _("Chat Window"));
+
   pixbuf = 
     gdk_pixbuf_new_from_file (GNOMEMEETING_IMAGES PACKAGE_NAME ".png", NULL);
+  if (pixbuf) {
+
   gtk_window_set_icon (GTK_WINDOW (chat_window), pixbuf);
-  gtk_window_set_position (GTK_WINDOW (chat_window), GTK_WIN_POS_CENTER);
   g_object_unref (pixbuf);
+  }
+
+  gtk_window_set_position (GTK_WINDOW (chat_window), GTK_WIN_POS_CENTER);
 
   /* Set the internal data */
   tw = new GmTextChatWindow ();
diff -ur gnomemeeting-opal/src/druid.cpp gnomemeeting/src/druid.cpp
--- gnomemeeting-opal/src/druid.cpp	2005-12-01 21:09:06.000000000 +0100
+++ gnomemeeting/src/druid.cpp	2005-12-04 09:42:32.000000000 +0100
@@ -1943,11 +1943,15 @@
   
   pixbuf = 
     gdk_pixbuf_new_from_file (GNOMEMEETING_IMAGES PACKAGE_NAME ".png", NULL);
-  gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+  if (pixbuf) {
+
+    gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+    g_object_unref (pixbuf);
+  }
+
   gtk_window_set_title (GTK_WINDOW (window), 
 			_("First Time Configuration Druid"));
   gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
-  g_object_unref (pixbuf);
 
 
   dw = new GmDruidWindow;
diff -ur gnomemeeting-opal/src/log_window.cpp gnomemeeting/src/log_window.cpp
--- gnomemeeting-opal/src/log_window.cpp	2005-05-25 22:07:34.000000000 +0200
+++ gnomemeeting/src/log_window.cpp	2005-12-04 09:53:19.000000000 +0100
@@ -119,11 +119,16 @@
 			  g_strdup ("log_window"), g_free);
   
   gtk_window_set_title (GTK_WINDOW (window), _("General History"));
+
   pixbuf = 
     gdk_pixbuf_new_from_file (GNOMEMEETING_IMAGES PACKAGE_NAME ".png", NULL);
-  gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+  if (pixbuf) {
+
+    gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+    g_object_unref (pixbuf);
+  }
+
   gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
-  g_object_unref (pixbuf);
   
   
   /* The GMObject data */
diff -ur gnomemeeting-opal/src/main_window.cpp gnomemeeting/src/main_window.cpp
--- gnomemeeting-opal/src/main_window.cpp	2005-12-03 20:56:07.000000000 +0100
+++ gnomemeeting/src/main_window.cpp	2005-12-04 09:41:27.000000000 +0100
@@ -3766,11 +3766,16 @@
   
   /* Add the window icon and title */
   gtk_window_set_title (GTK_WINDOW (window), _("GnomeMeeting"));
+
   pixbuf = 
     gdk_pixbuf_new_from_file (GNOMEMEETING_IMAGES PACKAGE_NAME ".png", NULL);
-  gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+  if (pixbuf) {
+
+    gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+    g_object_unref (G_OBJECT (pixbuf));
+  }
+
   gtk_widget_realize (window);
-  g_object_unref (G_OBJECT (pixbuf));
   gtk_window_set_resizable (GTK_WINDOW (window), false);
 
   g_signal_connect_after (G_OBJECT (mw->main_notebook), "switch-page",
diff -ur gnomemeeting-opal/src/tools.cpp gnomemeeting/src/tools.cpp
--- gnomemeeting-opal/src/tools.cpp	2005-12-01 21:09:07.000000000 +0100
+++ gnomemeeting/src/tools.cpp	2005-12-04 09:35:17.000000000 +0100
@@ -296,8 +296,12 @@
   gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
   pixbuf = 
     gdk_pixbuf_new_from_file (GNOMEMEETING_IMAGES PACKAGE_NAME ".png", NULL);
-  gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
-  g_object_unref (pixbuf);
+
+  if (pixbuf) {
+
+    gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+    g_object_unref (pixbuf);
+  }
 
   /* Introduction label */
   label = gtk_label_new (_("You can make calls to regular phones and cell numbers worldwide using GnomeMeeting. To enable this, you need to register an account using the URL below, then enter your Account number and PIN, and finally enable registering to the GnomeMeeting PC-To-Phone service.\n\nPlease make sure you are using the URL below to get your account otherwise the service will not work."));


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