GNOME Bugzilla – Bug 669211
Don't call optional vfuncs when they don't exists
Last modified: 2012-02-07 14:29:21 UTC
From a shallow reading of the gvfs code, GVfsBackend::try_* vfuncs are optional, and in fact many backend don't implement all of them. On the other hand, GVfsJobUnmount->try calls try_unmount unconditionally if either try_unmount or unmount is implemented, and no processes are blocking unmount. Practically speaking, this results in gvfsd-archive and gvfsd-ftp crashing. Probably other backends are affected too, since "git grep -e '->try_unmount'" only shows sftp implementing it. Fast patch that I think fixes this coming. (This is downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=744564 )
Created attachment 206601 [details] [review] GVfsJobUnmount: check that vfunc is implemented before calling it GVfsBackend::try_unmount is optional (like all the other try_* vfuncs), and in fact many backends don't implement it. In case it's NULL, returing FALSE does the right thing and schedules a thread for calling ->unmount.
Thank you for the patch.
Oh, nice shot, thanks for spotting this. I've added one more check in run() though it seems it's not needed. commit e523572e14a9042696e1c5ccd4f30cb3240fa0df Author: Giovanni Campagna <gcampagna@src.gnome.org> Date: Tue Feb 7 15:25:05 2012 +0100 GVfsJobUnmount: check that vfunc is implemented before calling it GVfsBackend::try_unmount is optional (like all the other try_* vfuncs), and in fact many backends don't implement it. In case it's NULL, returing FALSE does the right thing and schedules a thread for calling ->unmount. https://bugzilla.gnome.org/show_bug.cgi?id=669211
*** Bug 655147 has been marked as a duplicate of this bug. ***