After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 529533 - Warning about wrapping unwrapped implementation types (e.g. GHalMount)
Warning about wrapping unwrapped implementation types (e.g. GHalMount)
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: giomm
unspecified
Other Windows
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
: 535675 539560 539895 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-04-23 12:56 UTC by Jonathon Jongsma
Modified: 2008-06-24 10:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] * gio/src/mount.hg: Add a TypeTraits implementation for (1.59 KB, patch)
2008-04-24 01:47 UTC, Jonathon Jongsma
none Details | Review
glibmm_mount_traits2.patch (1.68 KB, patch)
2008-04-24 09:18 UTC, Murray Cumming
committed Details | Review

Description Jonathon Jongsma 2008-04-23 12:56:48 UTC
When I run the following program, I get the following output:

(process:11780): glibmm-WARNING **: failed to wrap type of 'GHalMount'
Mounts 1

You will get this warning once for each mount that is found, so if you have 0 mounts, you won't see the warning.  You may need to insert a cdrom or something to get a GHalMount to appear, I'm not sure.

================ Test case ===============

#include <iostream>
#include <ostream>
#include <vector>
 
#include <giomm.h>
 
int main()
{
	Gio::init();
 
	using namespace Glib;
	using namespace Gio;
 
	RefPtr<VolumeMonitor> monitor = VolumeMonitor::get();
 
	std::vector<RefPtr<Mount> > mounts = monitor->get_mounts();
 
	std::cout << "Mounts " << mounts.size() << '\n';
}
Comment 1 Murray Cumming 2008-04-23 18:10:09 UTC
The backtrace when the warning is printed:

(gdb) bt
  • #0 IA__g_log
    at gmessages.c line 516
  • #1 Glib::wrap_auto
    at wrap.cc line 190
  • #2 Glib::Container_Helpers::TypeTraits<Glib::RefPtr<Gio::Mount> >::to_cpp_type
  • #3 Glib::Container_Helpers::ListHandleIterator<Glib::Container_Helpers::TypeTraits<Glib::RefPtr<Gio::Mount> > >::operator*
  • #4 std::__uninitialized_copy_aux<Glib::Container_Helpers::ListHandleIterator<Glib::Container_Helpers::TypeTraits<Glib::RefPtr<Gio::Mount> > >, Glib::RefPtr<Gio::Mount>*>
  • #5 std::uninitialized_copy<Glib::Container_Helpers::ListHandleIterator<Glib::Container_Helpers::TypeTraits<Glib::RefPtr<Gio::Mount> > >, Glib::RefPtr<Gio::Mount>*>
  • #6 std::__uninitialized_copy_a<Glib::Container_Helpers::ListHandleIterator<Glib::Container_Helpers::TypeTraits<Glib::RefPtr<Gio::Mount> > >, Glib::RefPtr<Gio::Mount>*, Glib::RefPtr<Gio::Mount> >
  • #7 std::vector<Glib::RefPtr<Gio::Mount>, std::allocator<Glib::RefPtr<Gio::Mount> > >::_M_range_initialize<Glib::Container_Helpers::ListHandleIterator<Glib::Container_Helpers::TypeTraits<Glib::RefPtr<Gio::Mount> > > >
  • #8 std::vector<Glib::RefPtr<Gio::Mount>, std::allocator<Glib::RefPtr<Gio::Mount> > >::_M_initialize_dispatch<Glib::Container_Helpers::ListHandleIterator<Glib::Container_Helpers::TypeTraits<Glib::RefPtr<Gio::Mount> > > >
  • #9 std::vector<Glib::RefPtr<Gio::Mount>, std::allocator<Glib::RefPtr<Gio::Mount> > >::vector<Glib::Container_Helpers::ListHandleIterator<Glib::Container_Helpers::TypeTraits<Glib::RefPtr<Gio::Mount> > > >
  • #10 _ZNK4Glib10ListHandleINS_6RefPtrIN3Gio5MountEEENS_17Container_Helpers10TypeTraitsIS4_EEEcvSt6vectorIT_SaISA_EEIS4_EEv
  • #11 main

Comment 2 Murray Cumming 2008-04-23 18:19:34 UTC
We might need to implement a TypeTraits< Glib::RefPtr<Gio::Mount> > (and use it in the return type for get_mounts()) to ensure that it calls the wrap(GMount*, bool) function rather than a generic wrap(GObject*) function.

That way, it would call wrap_auto_interface() instead of wrap_auto(). wrap_auto_interface() can wrap implementations of interfaces even if the implementor type is unknown. A generic wrap(GObject*) function can't know which type (an implemented interface or an implementing type) we want.
Comment 3 Jonathon Jongsma 2008-04-24 01:47:26 UTC
Created attachment 109795 [details] [review]
[PATCH] 	* gio/src/mount.hg: Add a TypeTraits implementation for

	Glib::RefPtr<Gio::Mount> so that we can wrap implementor types that don't
	have a wrapper (e.g. GHalMount in gvfs).  Fixes bug #529533
---
 ChangeLog        |    6 ++++++
 gio/src/mount.hg |   29 +++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
Comment 4 Jonathon Jongsma 2008-04-24 01:56:00 UTC
The previous patch seems to fix things for me, does it look ok to you, murray?  Are we going to need to this for Gio::Volume, Gio::Drive, Gio::File, etc?
Comment 5 Jonathon Jongsma 2008-04-24 02:16:10 UTC
It looks like we'll have to do this for Volume and Drive, but not File.  The TypeTraits are only used when trying to construct a list of objects, right?  And giomm doesn't have any api which returns a list of files (the closest is a FileEnumerator object), so if my understanding of TypeTraits is correct, we don't really need one for File at the moment.
Comment 6 Murray Cumming 2008-04-24 09:13:06 UTC
Yes, that works for me. Thanks for making the patch.

However, I think this patch is slightly more obvious. I don't like using wrap_auto_interface() directly.

Yes, I think we'll need this for the other interfaces when used in a ListHandle. The C functions for these didn't work in jhbuild for me at the time so, of course, everything that's not tested doesn't work. 
Comment 7 Murray Cumming 2008-04-24 09:18:04 UTC
Created attachment 109810 [details] [review]
glibmm_mount_traits2.patch
Comment 8 Jonathon Jongsma 2008-04-24 12:54:40 UTC
Ah, OK.  Yours looks cleaner than mine.  I still don't have a great understanding of how the whole wrap system works.  I'll add TypeTraits for Drive and Volume similar to your patch above and commit it.
Comment 9 Jonathon Jongsma 2008-04-26 04:13:29 UTC
fixed in trunk.
Comment 10 Benoît Dejean 2008-06-22 08:34:47 UTC
*** Bug 539560 has been marked as a duplicate of this bug. ***
Comment 11 Benoît Dejean 2008-06-22 08:35:17 UTC
*** Bug 535675 has been marked as a duplicate of this bug. ***
Comment 12 Murray Cumming 2008-06-22 11:36:04 UTC
Note that this is now in a glibmm 2.16.x tarball.
Comment 13 Gianluca Borello 2008-06-24 10:42:10 UTC
*** Bug 539895 has been marked as a duplicate of this bug. ***