Revision: 1958
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1958&view=rev
Author:   jcsjcs
Date:     2008-04-13 05:46:46 -0700 (Sun, 13 Apr 2008)

Log Message:
-----------
        * src/display_photo.c (gphoto_is_photo_playlist,
          gphoto_ipod_supports_photos, gphoto_display_photo_window,
          debug_list_photos): prevent segfault if called with NULL
          argument.

          (gphoto_add_image_to_database,
          gphoto_add_image_to_iconview): sanity checks

        * context_menus.c (pm_context_menu_init): check for selected
          playlist before making further checks. Thanks to Alex
          Pounds.

Modified Paths:
--------------
    gtkpod/trunk/ChangeLog
    gtkpod/trunk/src/context_menus.c
    gtkpod/trunk/src/display_photo.c

Modified: gtkpod/trunk/ChangeLog
===================================================================
--- gtkpod/trunk/ChangeLog      2008-04-10 14:08:43 UTC (rev 1957)
+++ gtkpod/trunk/ChangeLog      2008-04-13 12:46:46 UTC (rev 1958)
@@ -1,3 +1,18 @@
+2008-04-13 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+       * src/display_photo.c (gphoto_is_photo_playlist,
+          gphoto_ipod_supports_photos, gphoto_display_photo_window,
+          debug_list_photos): prevent segfault if called with NULL
+          argument.
+
+         (gphoto_add_image_to_database,
+         gphoto_add_image_to_iconview): sanity checks
+
+       * context_menus.c (pm_context_menu_init): check for selected
+          playlist before making further checks. Thanks to Alex
+          Pounds.
+
+
 2008-04-09 Jorg Schuler <jcsjcs at users.sourceforge.net>
 
        * scripts/sync-tomboy.sh

Modified: gtkpod/trunk/src/context_menus.c
===================================================================
--- gtkpod/trunk/src/context_menus.c    2008-04-10 14:08:43 UTC (rev 1957)
+++ gtkpod/trunk/src/context_menus.c    2008-04-13 12:46:46 UTC (rev 1958)
@@ -1213,12 +1213,14 @@
     entry_inst = -1;
     selected_playlist = pm_get_selected_playlist();
     
-    /* Dont allow context menu to display if the playlist is the photo one */
-    if (gphoto_is_photo_playlist (selected_playlist)) return;
-        
     active_itdb = gp_get_selected_itdb ();
+
     if(selected_playlist)
     {
+       /* Dont allow context menu to display if the playlist is the
+        * photo one */
+       if (gphoto_is_photo_playlist (selected_playlist)) return;
+        
        selected_tracks = g_list_copy (selected_playlist->members);
        create_context_menu (CM_PL);
     }

Modified: gtkpod/trunk/src/display_photo.c
===================================================================
--- gtkpod/trunk/src/display_photo.c    2008-04-10 14:08:43 UTC (rev 1957)
+++ gtkpod/trunk/src/display_photo.c    2008-04-13 12:46:46 UTC (rev 1958)
@@ -150,8 +150,7 @@
        const gchar *mp;
        GError *error= NULL;
 
-       if (itdb == NULL)
-               return;
+       g_return_if_fail (itdb);
 
        eitdb = itdb->userdata;
        mp = itdb_get_mountpoint (itdb);
@@ -189,6 +188,8 @@
  */
 gboolean gphoto_ipod_supports_photos(iTunesDB *itdb)
 {
+        g_return_val_if_fail (itdb, FALSE);
+
        gboolean status = itdb_device_supports_photo (itdb->device);
        
        return status;
@@ -207,7 +208,9 @@
  */
 gboolean gphoto_is_photo_playlist(Playlist *pl)
 {
-       return pl->type == GP_PL_TYPE_PHOTO;
+    g_return_val_if_fail (pl, FALSE);
+
+    return pl->type == GP_PL_TYPE_PHOTO;
 }
 
 /**
@@ -223,6 +226,8 @@
 {
        ExtraiTunesDBData *eitdb;
 
+       g_return_if_fail (itdb);
+
        ipod_itdb = itdb;
 #if DEBUG
        printf ("Displaying photo window\n");
@@ -805,6 +810,8 @@
        GError *error= NULL;
        Artwork *image= NULL;
 
+       g_return_if_fail (photo_filename);
+
        /* Add the photo to the photo database and the 
         * default photo library album
         */
@@ -863,6 +870,8 @@
                gfloat pixbuf_width, pixbuf_height;
                gfloat ratio;
 
+               g_return_if_fail (photo);
+
                model = GTK_LIST_STORE (gtk_icon_view_get_model 
(thumbnail_view));
                for (i = 0; i < PHOTO_TYPES_SIZE && thumb == NULL; ++i)
                {
@@ -1668,6 +1677,8 @@
        PhotoDB *db;
        GList *gl_album;
 
+       g_return_if_fail (itdb);
+
        eitdb = itdb->userdata;
        db = eitdb->photodb;
        if (db == NULL)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to