[Thunar-dev] ThunarVfsInfo: Bug in thunar_vfs_info_new_for_path?

Jannis Pohlmann info at sten-net.de
Wed Feb 1 14:59:36 CET 2006


Hey,

Benedikt Meurer schrieb:
> Jannis Pohlmann wrote:
> 
>>So, basically, I create a new ThunarVfsPath object from argv[1] and try
>>to acquire the ThunarVfsInfo based on it. What I noticed now is that the
>>path data is lost after the thunar_vfs_info_new_for_path call. Here's
>>the output:
>>
>>  jannis at nebelsee ~/Projects/Aye/src>./aye /tmp/XmlIniFile.html
>>  Path name (before info): XmlIniFile.html
>>  Path name (after info):
>>  Path name (after path unref):
>>
>>The file /tmp/XmlIniFile.html exists and the GError variable 'error' is
>>NULL, even after the initialization of file_info; so I guess this may be
>>a bug.
>>
>>Any ideas?
> 
> 
> I cannot reproduce your problem. Attached is a complete example, please
> check if that works.

No, that results in the same output. I've attached the build file below
and also added #define EXO_API_SUBJECT_TO_CHANGE on top of your code.

- Jannis


jannis at nebelsee ~/tmp/thunar-vfs> ls
build.sh  main.c
jannis at nebelsee ~/tmp/thunar-vfs> cat main.c
#define EXO_API_SUBJECT_TO_CHANGE

#include <thunar-vfs/thunar-vfs.h>

int
main (int argc, char **argv)
{
  ThunarVfsInfo *file_info;
  ThunarVfsPath *path;
  GError        *error = NULL;

  gtk_init (&argc, &argv);
  g_thread_init (NULL);

  thunar_vfs_init ();

  path = (argc > 1) ? thunar_vfs_path_new (argv[1], &error) : NULL;

  if (G_LIKELY (path != NULL)) {

    fprintf (stderr, "Path name (before info): %s\n",
             thunar_vfs_path_get_name (path));

    file_info = thunar_vfs_info_new_for_path (path, &error);
    if (G_LIKELY (file_info != NULL))
      {
        fprintf (stderr, "Path name (after info): %s\n",
                 thunar_vfs_path_get_name (file_info->path));

        thunar_vfs_path_unref (path);

        fprintf (stderr, "Path name (after path unref): %s\n",
                 thunar_vfs_path_get_name (file_info->path));

        thunar_vfs_info_unref (file_info);
      }
  }

  thunar_vfs_shutdown ();

  return 0;
}
jannis at nebelsee ~/tmp/thunar-vfs> cat build.sh
#!/bin/bash

gcc -DHAVE_CONFIG_H \
        -I. \
        -I. \
        -I.. \
        -I/usr/include/gtk-2.0 \
        -I/usr/lib/gtk-2.0/include \
        -I/usr/include/atk-1.0 \
        -I/usr/include/cairo \
        -I/usr/include/pango-1.0 \
        -I/usr/include/glib-2.0 \
        -I/usr/lib/glib-2.0/include \
        -I/usr/include \
        -I/usr/local/include/thunar-vfs-1 \
        -I/usr/local/include/exo-0.3 \
        -I/usr/include/glib-2.0 \
        -I/usr/lib/glib-2.0/include \
        -I/usr/local/include/xfce4 \
        -I/usr/include/gtk-2.0 \
        -I/usr/include/cairo -I/usr/include/pango-1.0 \
        -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 \
        -Wall \
        -g \
        -g \
        -O2 \
        -MT main.o \
        -MD \
        -MP \
        -c \
        -o main.o main.c

gcc \
        -Wall \
        -g \
        -g \
        -O2 \
        -o test \
        -L/usr/lib \
        -L/usr/local/lib \
        main.o \
        -lgtk-x11-2.0 \
        -latk-1.0 \
        -lgdk-x11-2.0 \
        -lgdk_pixbuf-2.0 \
        -lm \
        -lpangocairo-1.0 \
        -lfontconfig \
        -lXinerama \
        -lXi \
        -lXrandr \
        -lXext \
        -lXcursor \
        -lXfixes \
        -lpango-1.0 \
        -lcairo \
        -lgobject-2.0 \
        -lgmodule-2.0 \
        -lglib-2.0 \
        -lXrender \
        -lX11 \
        -ldl \
        -lgamin-1 \
        -lthunar-vfs-1 \
        -lexo-0.3

jannis at nebelsee ~/tmp/thunar-vfs> bash build.sh
jannis at nebelsee ~/tmp/thunar-vfs> ./test ~/Arbeit/XmlIniFile.html
Path name (before info): XmlIniFile.html
Path name (after info):
Path name (after path unref):
jannis at nebelsee ~/tmp/thunar-vfs>



More information about the Thunar-dev mailing list