Re: compiling gtkmm with atkmm support fails in implementor.cc



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

I have removed ~Implementor() destructor and let the compiler generate one.
recompiled atkmm and it now it works just fine!

Please give your opinion, did I do the right thing? I'm not 100% sure.


On Wed, Nov 18, 2015 at 3:07 PM, John Emmas <john creativepost co uk> wrote:
On 18/11/2015 12:39, John Emmas wrote:

   //Any instantiable class that derives from Interface should also inherit from Object.

I noticed that Atk::Implmentor does derive from Glib::Interface but it doesn't inherit from Object.  Could that be the problem?


I just discovered something else interesting...  I don't know if this is technically valid code but FWIW, even something as simple as this hangs:-

    int main (int argc, char *argv[])
    {
        Atk::Implementor  *imp = new Atk::Implementor (NULL);

        delete imp;  // <-- hangs here !!

        return 0;
    }

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




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