Crash when creating a KHTMLView

Andreas Kling kling at impul.se
Thu Aug 11 08:42:08 BST 2005


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):

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