add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / cellrendereraccel.cc
index 0e10e4d80f8fe799ca17a3ca8c23d9ac57fa7b89..9cadd021ca4f6eef359517ab6e053d83a9dd0c3d 100644 (file)
@@ -171,7 +171,7 @@ void CellRendererAccel_Class::class_init_function(void* g_class, void* class_dat
 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 void CellRendererAccel_Class::accel_edited_callback(GtkCellRendererAccel* self, const gchar* p0, guint p1, GdkModifierType p2, guint p3)
 {
-  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
   // Non-gtkmmproc-generated custom classes implicitly call the default
@@ -179,38 +179,41 @@ void CellRendererAccel_Class::accel_edited_callback(GtkCellRendererAccel* self,
   // generated classes can use this optimisation, which avoids the unnecessary
   // parameter conversions if there is no possibility of the virtual function
   // being overridden:
-  if(obj && obj->is_derived_())
+  if(obj_base && obj_base->is_derived_())
   {
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    try // Trap C++ exceptions which would normally be lost because this is a C callback.
+    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    if(obj) // This can be NULL during destruction.
     {
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
-      // Call the virtual member method, which derived classes might override.
-      obj->on_accel_edited(Glib::convert_const_gchar_ptr_to_ustring(p0)
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      try // Trap C++ exceptions which would normally be lost because this is a C callback.
+      {
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+        // Call the virtual member method, which derived classes might override.
+        obj->on_accel_edited(Glib::convert_const_gchar_ptr_to_ustring(p0)
 , p1, ((Gdk::ModifierType)(p2))
 , p3);
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    }
-    catch(...)
-    {
-      Glib::exception_handlers_invoke();
+        return;
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
     }
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
   }
-  else
-  {
-    BaseClassType *const base = static_cast<BaseClassType*>(
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
     );
 
-    // Call the original underlying C function:
-    if(base && base->accel_edited)
-      (*base->accel_edited)(self, p0, p1, p2, p3);
-  }
+  // Call the original underlying C function:
+  if(base && base->accel_edited)
+    (*base->accel_edited)(self, p0, p1, p2, p3);
 }
 void CellRendererAccel_Class::accel_cleared_callback(GtkCellRendererAccel* self, const gchar* p0)
 {
-  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
   // Non-gtkmmproc-generated custom classes implicitly call the default
@@ -218,33 +221,36 @@ void CellRendererAccel_Class::accel_cleared_callback(GtkCellRendererAccel* self,
   // generated classes can use this optimisation, which avoids the unnecessary
   // parameter conversions if there is no possibility of the virtual function
   // being overridden:
-  if(obj && obj->is_derived_())
+  if(obj_base && obj_base->is_derived_())
   {
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    try // Trap C++ exceptions which would normally be lost because this is a C callback.
+    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    if(obj) // This can be NULL during destruction.
     {
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
-      // Call the virtual member method, which derived classes might override.
-      obj->on_accel_cleared(Glib::convert_const_gchar_ptr_to_ustring(p0)
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      try // Trap C++ exceptions which would normally be lost because this is a C callback.
+      {
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+        // Call the virtual member method, which derived classes might override.
+        obj->on_accel_cleared(Glib::convert_const_gchar_ptr_to_ustring(p0)
 );
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    }
-    catch(...)
-    {
-      Glib::exception_handlers_invoke();
+        return;
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
     }
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
   }
-  else
-  {
-    BaseClassType *const base = static_cast<BaseClassType*>(
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
     );
 
-    // Call the original underlying C function:
-    if(base && base->accel_cleared)
-      (*base->accel_cleared)(self, p0);
-  }
+  // Call the original underlying C function:
+  if(base && base->accel_cleared)
+    (*base->accel_cleared)(self, p0);
 }
 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 
@@ -290,7 +296,8 @@ GType CellRendererAccel::get_base_type()
 
 CellRendererAccel::CellRendererAccel()
 :
-  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
+  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+  Glib::ObjectBase(0),
   Gtk::CellRendererText(Glib::ConstructParams(cellrendereraccel_class_.init()))
 {
   }