Reasoning behind wxObject not inheriting from wxTrackable?

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
kpedersen
In need of some credit
In need of some credit
Posts: 7
Joined: Sat Aug 18, 2012 1:15 pm

Reasoning behind wxObject not inheriting from wxTrackable?

Post by kpedersen »

In the documentation it states that by default, wxEvtHandler and wxWindow derive from wxTrackable. However, wxObject does not.

Indeed, if I attempt to assign a wxMenu pointer to a wxWeakRef<wxMenu> it works however if I attempt to assign a wxMenuItem pointer to a wxWeakRef<wxMenuItem> it does not and an error occurs at compile time because a static_cast fails somewhere in the depths of wxWidgets.

Is there a reason that wxObject does not derive from wxTrackable so that every class will "just work" with wxWeakRef?

I am terrible with raw pointers and like to use weak / shared wrappers whenever possible ;)

I would currently have to hack at the source code to add a wxTrackable base class to wxObject and modify all instances of classes deriving from both wxObject and wxTrackable to remove the "inheritance ambiguous" compile errors.

Before I consider doing this, I just want to check if there are any other issues that I would encounter that I haven't thought of yet! Or is there a better solution?

Thanks
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7481
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Reasoning behind wxObject not inheriting from wxTrackable?

Post by ONEEYEMAN »

Hi,
This forum is user-driven and is for users.

If you want an answer to you question - post to wx-dev ML.

Thank you.
Post Reply