Why should it call Glib::Object::~Object()? Atk::Implementor does not
inherit from Glib::Object.

Oh, Yes you are correct, but see this:

*Gtk::Widget*

class Widget : public Object, public Buildable
*#ifdef GTKMM_ATKMM_ENABLED*
  ,*public Atk::Implementor*
{
  //...
}

*Gtk::Widget* inherits *Gtk::Object*, which in turn inherits *Glib::Object*
which in turn inherits *Glib::ObjectBase*
*Gtk::Widget* also inherits *Atk::Implementor* which in turn inherits
*Glib::Interface* which in turn inherits *Glib::ObjectBase*

This is the *only* place where Atk::Implementor gets inherited in entry
gtkmm project.

I searched entry gtkmm sources ( CTRL + F ) for "public Atk::Implementor"
and only Gtk::Widget inherits Atk::Implementor.

I believe this is the place where we should continue this silly research.


On Wed, Nov 18, 2015 at 8:24 PM, Kjell Ahlstedt <[email protected]
> wrote:

>
>
> Den 2015-11-18 kl. 19:23, skrev codekiddy:
>
> Hey guys,
>
> I compiled gtkmm with GTKMM_ATKMM_ENABLED 1
>
> Applied a simple fix, run an example gtkmm program and it works just fine!
>
>
>
> Here is how classes inherit destructors in order: ( I marked important
> code with bold )
>
>
> *Glib::ObjectBase*
>
> class ObjectBase : virtual public sigc::trackable
> {
>   *protected:*
>         virtual ~ObjectBase() noexcept = 0; // pure virtual dtor, any
> derived class dtor *won't throw.*
> }
>
>
>
> *Glib::Object*
>
> class Object : virtual *public ObjectBase*
> {
>   *protected:*
>        virtual ~Object() noexcept;
> }
>
>
>
> *Glib::Interface*
>
> class Interface : virtual *public Glib::ObjectBase*
> {
>    *public:*
>        virtual ~Interface() noexcept;
> }
>
>
> *Atk::Implementor*
>
> class Implementor : *public Glib::Interface*
> {
>     public:
>          virtual ~Implementor() noexcept; *// I think this is bad, you'll
> see why ...*
>
> }
>
> *Gtk::Widget*
>
> class Widget : public Object, public Buildable
> *#ifdef GTKMM_ATKMM_ENABLED*
>   ,*public Atk::Implementor*
> {
>   //...
> }
>
>
> Now let's see the implementation of Atk::~Implementor()
>
> *Implementor::~Implementor() noexcept { }* * // do you see why this is
> bad ?*
>
>
>
> Atk::~Implementor is defined but it can't call Glib::Object::~Object()
> *because Glib::Object::~Object() is declared protected*
>
> Why should it call Glib::Object::~Object()? Atk::Implementor does not
> inherit from Glib::Object.
>
> I have removed ~Implementor() destructor and let the compiler generate one.
> recompiled atkmm and it now it works just fine!
>
> Interesting, but I don't understand what's the difference between
>   Implementor::~Implementor() noexcept { }
> and a compiler-generated destructor. Is noexcept bad here?
> Gtk::Buildable::~Buildable() and many other destructors look the same.
>
> The preprocessor may replace noexcept by _NOEXCEPT because of these lines
> in glibmmconfig.h:
>
> #if (_MSC_VER < 1900) && !defined (noexcept)
> #define _ALLOW_KEYWORD_MACROS 1
> #define noexcept _NOEXCEPT
> #endif
>
> Please give your opinion, did I do the right thing? I'm not 100% sure.
>
>
>
>
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to