summaryrefslogtreecommitdiff
path: root/glib/glibmm
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2009-01-09 15:32:34 +0000
committerMurray Cumming <murrayc@src.gnome.org>2009-01-09 15:32:34 +0000
commit9a52b944b50890d0e222bbcf15922e7533bee475 (patch)
tree650f1a1ebb1cc4f183435e3a025e9fc80525104f /glib/glibmm
parent312625c59865b9728b1fefb237067cf738933ebd (diff)
downloadglibmm-9a52b944b50890d0e222bbcf15922e7533bee475.tar.gz
wrap_auto_interface<>(): Add a warning to give a clue when the
2009-01-09 Murray Cumming <murrayc@murrayc.com> * 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
Diffstat (limited to 'glib/glibmm')
-rw-r--r--glib/glibmm/wrap.h10
1 files changed, 8 insertions, 2 deletions
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<TInterface*>(pCppObject);
+ {
+ result = dynamic_cast<TInterface*>(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.