Problems with KHTMView (and KHTMLPart) constructors

Germain Garand germain at ebooksfrance.org
Mon Dec 17 13:32:15 GMT 2007


Le Lundi 17 Décembre 2007 11:09, Eeli Kaikkonen a écrit :
> On Mon, 17 Dec 2007, Germain Garand wrote:
> > We are not going to change the API at this point, but please check if the
> > attached patch may address your concerns.
>
> Unfortunately it crashes. Here is the debug output:
[...]
> KHTMLView::setPart(KHTMLPart*): Assertion `part && !m_part' failed.
[...]
> This is our code where this happens:
>
> CHTMLReadDisplay::CHTMLReadDisplay(CReadWindow* readWindow, QWidget*
> parentWidget)
>
> 	: KHTMLPart(m_view = new CHTMLReadDisplayView(
>
> 			this, parentWidget ? parentWidget : readWindow),
> readWindow ? readWindow : parentWidget),
>
> (Our class is used in different situations, therefore the hairy code.
> It's easy to see why my first thought when seeing this code was "this
> will be break things some day".)

ah right, I forgot to only set the part if it's not already set. That's even 
what my documentation says :)

[...]

> One note about the unit test: it doesn't test the init list
> constructing. That should be added, I think. Maybe that would have
> cought also the bug I now found...

Indeed. Updated patch attached...

Greetings,
Germain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-diff
Size: 8575 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20071217/6a63696f/attachment.diff>


More information about the kfm-devel mailing list