glibmm r774 - in trunk: . glib/glibmm



Author: murrayc
Date: Fri Jan  9 15:32:34 2009
New Revision: 774
URL: http://svn.gnome.org/viewvc/glibmm?rev=774&view=rev

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

Modified:
   trunk/ChangeLog
   trunk/glib/glibmm/wrap.h

Modified: trunk/glib/glibmm/wrap.h
==============================================================================
--- trunk/glib/glibmm/wrap.h	(original)
+++ trunk/glib/glibmm/wrap.h	Fri Jan  9 15:32:34 2009
@@ -78,9 +78,15 @@
   //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.



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