Source: snappy-player
Version: 0.2-1
Severity: normal
Tags: upstream patch

Dear Maintainer,

$ snappy Vinid\ \&\ State-V\ -\ Belief.mp3 
Loading: file:///root/Music/Vinid & State-V - Belief.mp3
Loading ui!

(snappy:28960): GLib-GObject-CRITICAL **: g_object_ref: assertion
G_IS_OBJECT (object)' failed

** (snappy:28960): WARNING **: Problem inhibiting the screensaver:
GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: Name
"org.gnome.SessionManager" does not exist
closing snappy
Segmentation fault

[ gdb foo... skipped ]

$ ls $HOME/.config/snappy

Supposedly you all have had ~/.config/snappy/ already in place for
a long time, so you haven't noticed the FAIL.

The attached patch fixes this for me. Please add to patches/series,
and sort out the header fields of the diff, when BTS entry returns.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 snappy-player (0.2-1) unstable; urgency=low
 .
   * New upstream release, "Mrs. Robinson, you're trying to seduce me.":
     + debian/control:
       - Build-depend on GLib >= 2.26 for GDBus, libxtst and
         gst-plugins-base >= 0.10.30.
Author: Sebastian Dröge <sl...@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- snappy-player-0.2.orig/src/gst_engine.c
+++ snappy-player-0.2/src/gst_engine.c
@@ -277,6 +277,19 @@ remove_uri_unfinished_playback (GstEngin
 
   /* Config file path */
   config_dir = g_get_user_config_dir ();
+
+  /* Self config directory, i.e. .config/snappy/ */
+  struct stat st_self;
+  if ( 0 != stat(g_strdup_printf("%s/snappy", config_dir), &st_self)) {
+     if ( 0 != mkdir( g_strdup_printf("%s/snappy", config_dir), 0777))
+       perror("Failed to create ~/.config/snappy/ directory");
+  }
+  else if (!S_ISDIR(st_self.st_mode)) {
+     errno = ENOTDIR;
+     perror("~/config/snappy/ already exists");
+  }
+
+  /* History file */
   path = g_strdup_printf ("%s/snappy/history", config_dir);
 
   /* Remove key from history file */
@@ -285,10 +298,14 @@ remove_uri_unfinished_playback (GstEngin
 
   /* Save gkeyfile to a file */
   data = g_key_file_to_data (keyfile, NULL, NULL);
-  file = fopen (path, "w");
-  fputs (data, file);
-  fclose (file);
-
+  if (NULL != (file = fopen (path, "w"))) {
+    fputs (data, file);
+    fclose (file);
+  }
+  else {
+    g_print("unable to open file: %s\n", path);
+  }
+   
   g_free (data);
   g_free (path);
 

Reply via email to