Crash when creating a KHTMLView

Koos Vriezen koos.vriezen at xs4all.nl
Thu Aug 11 09:09:06 BST 2005


On Thu, Aug 11, 2005 at 09:42:08AM +0200, Andreas Kling wrote:
> On Tue, Aug 09, 2005 at 10:30:57AM +0300, Andras Mantia wrote:
> >  Since a recent change in KHTMLView, Quanta crashes on startup when it 
> > tries to create a KHTMLView object. The code in Quanta does:
> >  KHTMLPart(new KHTMLView(this, widgetParent, name), parent, name)
> 
> Oh dear, I'm very sorry about breaking your application. :-\
> 
> Here's how I would fix it (and if no one complains, I'll commit it):

Well not really complaining, but would adding some comment make sense?
For me, it's not clear why you don't add the ref/deref in
KHTMLFactory::defaultHTMLSettings (avoiding using 'friend' also keeps
catching compile time error for eg. abusing a copy ctor).

Koos

> Index: khtmlview.cpp
> ===================================================================
> --- khtmlview.cpp	(revision 445557)
> +++ khtmlview.cpp	(working copy)
> @@ -253,7 +253,9 @@ public:
>  #endif // KHTML_NO_TYPE_AHEAD_FIND
>  	accessKeysActivated = false;
>  	accessKeysPreActivate = false;
> +        KHTMLFactory::ref();
>          accessKeysEnabled = KHTMLFactory::defaultHTMLSettings()->accessKeysEnabled();
> +        KHTMLFactory::deref();
>          emitCompletedAfterRepaint = CSNone;
>      }
>      void newScrollTimer(QWidget *view, int tid)
> Index: khtml_factory.h
> ===================================================================
> --- khtml_factory.h	(revision 445557)
> +++ khtml_factory.h	(working copy)
> @@ -40,6 +40,7 @@ class KDE_EXPORT KHTMLFactory : public K
>  {
>    Q_OBJECT
>    friend class DOM::DocumentImpl;
> +  friend class KHTMLViewPrivate;
>  public:
>    KHTMLFactory( bool clone = false );
>    virtual ~KHTMLFactory();




More information about the kfm-devel mailing list