From 9a52b944b50890d0e222bbcf15922e7533bee475 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Fri, 9 Jan 2009 15:32:34 +0000 Subject: wrap_auto_interface<>(): Add a warning to give a clue when the 2009-01-09 Murray Cumming * glib/glibmm/wrap.h: wrap_auto_interface<>(): Add a warning to give a clue when the dynamic_cast fails, for instance if you are doing some incorrect multiple inheritance. svn path=/trunk/; revision=774 --- glib/glibmm/wrap.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'glib/glibmm') diff --git a/glib/glibmm/wrap.h b/glib/glibmm/wrap.h index 94f17263..e7988abb 100644 --- a/glib/glibmm/wrap.h +++ b/glib/glibmm/wrap.h @@ -78,9 +78,15 @@ TInterface* wrap_auto_interface(GObject* object, bool take_copy = false) //so we at least get the expected type: TInterface* result = 0; if(pCppObject) - result = dynamic_cast(pCppObject); + { + result = dynamic_cast(pCppObject); + if(!result) + { + g_warning("Glib::wrap_auto_interface(): The C++ instance (%s) does not dynamic_cast to the interface.\n", typeid(*pCppObject).name()); + } + } else - result = new TInterface((typename TInterface::BaseObjectType*)object); + result = new TInterface((typename TInterface::BaseObjectType*)object); // take_copy=true is used where the GTK+ function doesn't do // an extra ref for us, and always for plain struct members. -- cgit v1.2.1