gtk+ r20031 - in trunk: . gtk
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r20031 - in trunk: . gtk
- Date: Mon, 21 Apr 2008 14:53:44 +0100 (BST)
Author: mitch
Date: Mon Apr 21 13:53:43 2008
New Revision: 20031
URL: http://svn.gnome.org/viewvc/gtk+?rev=20031&view=rev
Log:
2008-04-21 Michael Natterer <mitch imendio com>
* gtk/gtkselection.c: add tons of g_return_if_fail() instead of
crashing when NULL pointers get passed.
Modified:
trunk/ChangeLog
trunk/gtk/gtkselection.c
Modified: trunk/gtk/gtkselection.c
==============================================================================
--- trunk/gtk/gtkselection.c (original)
+++ trunk/gtk/gtkselection.c Mon Apr 21 13:53:43 2008
@@ -952,7 +952,9 @@
GList *tmp_list;
GList *next;
GtkSelectionInfo *selection_info;
-
+
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
/* Remove pending requests/incrs for this widget */
tmp_list = current_retrievals;
@@ -1127,6 +1129,8 @@
const guchar *data,
gint length)
{
+ g_return_if_fail (selection_data != NULL);
+
g_free (selection_data->data);
selection_data->type = type;
@@ -1367,6 +1371,8 @@
const gchar *str,
gint len)
{
+ g_return_val_if_fail (selection_data != NULL, FALSE);
+
if (len < 0)
len = strlen (str);
@@ -1417,6 +1423,8 @@
{
guchar *result = NULL;
+ g_return_val_if_fail (selection_data != NULL, NULL);
+
init_atoms ();
if (selection_data->length >= 0 &&
@@ -1475,6 +1483,9 @@
gchar *str, *type;
gsize len;
+ g_return_val_if_fail (selection_data != NULL, FALSE);
+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), FALSE);
+
formats = gdk_pixbuf_get_formats ();
for (f = formats; f; f = f->next)
@@ -1533,6 +1544,8 @@
GdkPixbufLoader *loader;
GdkPixbuf *result = NULL;
+ g_return_val_if_fail (selection_data != NULL, NULL);
+
if (selection_data->length > 0)
{
loader = gdk_pixbuf_loader_new ();
@@ -1571,6 +1584,9 @@
gtk_selection_data_set_uris (GtkSelectionData *selection_data,
gchar **uris)
{
+ g_return_val_if_fail (selection_data != NULL, FALSE);
+ g_return_val_if_fail (uris != NULL, FALSE);
+
init_atoms ();
if (selection_data->target == text_uri_list_atom)
@@ -1625,6 +1641,8 @@
{
gchar **result = NULL;
+ g_return_val_if_fail (selection_data != NULL, NULL);
+
init_atoms ();
if (selection_data->length >= 0 &&
@@ -1667,6 +1685,8 @@
GdkAtom **targets,
gint *n_atoms)
{
+ g_return_val_if_fail (selection_data != NULL, FALSE);
+
if (selection_data->length >= 0 &&
selection_data->format == 32 &&
selection_data->type == GDK_SELECTION_TYPE_ATOM)
@@ -1704,11 +1724,13 @@
**/
gboolean
gtk_targets_include_text (GdkAtom *targets,
- gint n_targets)
+ gint n_targets)
{
gint i;
gboolean result = FALSE;
+ g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE);
+
/* Keep in sync with gtk_target_list_add_text_targets()
*/
@@ -1756,6 +1778,7 @@
gint i, j;
gboolean result = FALSE;
+ g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE);
g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
init_atoms ();
@@ -1799,6 +1822,8 @@
gint n_targets;
gboolean result = FALSE;
+ g_return_val_if_fail (selection_data != NULL, FALSE);
+
init_atoms ();
if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
@@ -1833,6 +1858,7 @@
gint n_targets;
gboolean result = FALSE;
+ g_return_val_if_fail (selection_data != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
init_atoms ();
@@ -1871,6 +1897,8 @@
gint i;
gboolean result = FALSE;
+ g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE);
+
list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_image_targets (list, 0, writable);
for (i = 0; i < n_targets && !result; i++)
@@ -1913,6 +1941,8 @@
gint n_targets;
gboolean result = FALSE;
+ g_return_val_if_fail (selection_data != NULL, FALSE);
+
init_atoms ();
if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
@@ -1944,6 +1974,8 @@
gint i;
gboolean result = FALSE;
+ g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE);
+
/* Keep in sync with gtk_target_list_add_uri_targets()
*/
@@ -1981,6 +2013,8 @@
gint n_targets;
gboolean result = FALSE;
+ g_return_val_if_fail (selection_data != NULL, FALSE);
+
init_atoms ();
if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]