Re: mount_enclosing_volume_finish() segmentation fault



On Tue, 2012-07-17 at 11:20 +0200, Jan Vleeshouwers wrote:
> 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);

Is file non null? You could add an if(file) in there to be sure.

Also, is res non null?

>     } 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.

Do you have a gdb backtrace or a valgrind report?

>  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.

A NULL GFile* return value should be no problem for the giomm code. I
think we need to see that gdb backtrace or valgrind report, and/or some
simple test case that we can run here, please

[snip]

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com



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