mount_enclosing_volume_finish() segmentation fault



In a program which tries to mount Samba URIs (like
smb://thirdpc/Public), I come across the following situation.

For the Glib::RefPtr<Gio::File> file I am trying to mount, I call
(from within a Mounter class, which has 'file' as a private member):

  file->mount_enclosing_volume(sigc::mem_fun(*this, &Mounter::mount_callback));

The callback function finishes the mount:

  void Mounter::mount_callback(Glib::RefPtr<Gio::AsyncResult>& res)
  {

    bool mounted;

    try {
        mounted = file->mount_enclosing_volume_finish(res);
    } catch (Gio::Error& ex) {
        std::cerr << "mount_callback() Gio-exception: " << ex.what()
<< " (" << ex.code() << ")" << std::endl;
    } catch (Glib::Error& ex) {
        std::cerr << "mount_callback() Glib-exception: " << ex.what()
<< " (" << ex.code() << ")" << std::endl;
    }

    (left out)

  }

For many (all?) Samba URIs I tried to mount,
mount_enclosing_volume_finish() causes a segmentation fault. I have
not checked extensively, but it looks like it is not an essential
error, because the mount succeeds.

I created a Glib version of the whole program, with the callback:

  static void mount_callback(GObject *object, GAsyncResult *res,
gpointer user_data)
  {

    GFile *target;
    GError *error = NULL;
    target = g_file_mount_mountable_finish(G_FILE (object), res, &error);

    (left out)

  }

What I see now is that g_file_mount_mountable_finish() sometimes
(always?) returns a NULL target as well as a NULL error. Again, there
is no actual error, because the mount appears to succeed. From the
Gio-documentation, however, I would not expect this to be possible.

In the Glib-case I can simply work around this behaviour by ignoring
'target'. But in the Glibmm-case I am stuck with a function that
segfaults. I cannot just skip the call to
mount_enclosing_volume_finish().

What is happening here? Glibmm is new to me, so I might be doing
something wrong? I searched for solutions, but did not find any. Is
this a known problem? In case it matters: Ubuntu 12.04, with
libglibmm-2.4.so.1.3.0 and libgiomm-2.4.so.1.3.0. If it is helpful,
I'll provide complete working example programs - but not now, I don't
want to overdo my first post here;)


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