global destruction (dis)order

Kevin Funk kfunk at kde.org
Wed Aug 9 10:25:51 UTC 2017


On Wednesday, 9 August 2017 11:47:28 CEST René J.V. Bertin wrote:
> On Wednesday August 09 2017 09:57:35 Kevin Funk wrote:
> > m_mWin (used in ZealSearchView::~ZealSearchView()) should indeed be valid
> > at that point; all the other Kate/KTE plugins use the pointer to the main
> > window unconditionally.
> 
> Yeah, there's no reason it would be null at that point if not also null in
> the ctor.
> > No, the object (this) is half-destructed at this point. The warning comes
> > from KXMLGUIClient::~KXMLGUIClient().
> 
> I know. I half expected KXMLGUIClient to inherit a Qt type with meta info
> but no such luck.

> Still, as far as I understand, the standard C++ type_info
> data should persist until the application exits but I'm not getting
> anything useful out of it.

No: Inside the destructor the this pointer is well defined, as are all the 
members and bases. The only thing is that the object itself cannot be assumed 
anymore as "polymorphic", since the derived components had already been 
destroyed. (I shamelessly copied that from [1].)

IOW: Inside KXMLGUIClient::~KXMLGUIClient(), `this` is just an instance of  
type `KXMLGUIClient`, all other type information has been lost already.

> Looks like I'll have to print a few frames of stack backtrace after that
> warning if the issue confirms itself. Or turn the qWarning into a qFatal.

Yes.

> Cheers,
> R.

[1] https://stackoverflow.com/questions/25639140/validity-of-this-in-destructor

-- 
Kevin Funk | kfunk at kde.org | http://kfunk.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170809/6c0dee56/attachment.sig>


More information about the KDevelop-devel mailing list