Problem with refcounting KHTMLPart
Andras Mantia
amantia at kde.org
Mon Dec 3 19:16:32 GMT 2007
On Monday 03 December 2007, Christian Ehrlicher wrote:
> Hi,
>
> I get an assert on exiting konqueror in khtml_factory.cpp:63 (assert(
> !s_refcnt )).
>
> It looks like refcounting is broken, but it looks more like the
> problem is QObjectCleanupHandler() which deletes the objects directly
> instead calling KHTMLFactory::deref() --> when ( s_self == this )
> the refcount is still 1.
>
> How can this be fixed?
I also run into this problem and even debugged it once, but somehow I
forgot to send the results of the findings to the kfm mailing list.
Here is a mail that I sent to another Quanta developer when we run into
this issue:
---
The problem is that every KPluginFactory object (including KHTMLFactory)
is a global static and is deleted on closing the mainwindow. In case
of KHTMLFactory, if you do not delete the KHTMLPart which created the
factory, but you try to delete the factory itself, it will crash by
hitting that assert. As KHTMLPart objects do not have a parent (AFAIK),
they are not deleted automatically, so you must be sure that the part
is deleted.
In case of Quanta the problem is only partially solved. If the exit
is "clear", it will not hit this assert. If some other assert (or maybe
only a Q_ASSERT) is hit somewhere else, that will trigger an early exit
without deleting the KHTMLPart, so this assert will also be hit,
resulting in a confusing backtrace, like we had in Quanta...
--
The solution? I don't know, maybe change the refcounting or don't assert
if this happens on application exit (when the mainwindow is deleted).
Andras
--
Quanta Plus developer - http://quanta.kdewebdev.org
K Desktop Environment - http://www.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071203/e46a2da8/attachment.sig>
More information about the kde-core-devel
mailing list