Index: khtml/khtml_part.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/khtml_part.cpp,v
retrieving revision 1.101
retrieving revision 1.101.6.1
diff -u -r1.101 khtml/khtml_part.cpp
--- khtml/khtml_part.cpp	2002/12/21 01:56:42	1.101
+++ khtml_part.cpp	2003/01/14 21:23:55	1.101.6.1
@@ -501,11 +501,11 @@
   if ( d->m_doc && d->m_doc->isHTMLDocument() ) {
     HTMLDocumentImpl* hdoc = static_cast<HTMLDocumentImpl*>( d->m_doc );
 
-    if ( hdoc->body() && d->m_bLoadEventEmitted ) {
+    if ( hdoc->body() && d->m_bLoadEventEmitted && !d->m_bUnloadEventEmitted ) {
       hdoc->body()->dispatchWindowEvent( EventImpl::UNLOAD_EVENT, false, false );
       if ( d->m_doc )
         d->m_doc->updateRendering();
-      d->m_bLoadEventEmitted = false;
+      d->m_bUnloadEventEmitted = true;
     }
   }
 
@@ -1718,6 +1718,7 @@
   }
 
   d->m_bLoadEventEmitted = true;
+  d->m_bUnloadEventEmitted = false;
   if (d->m_doc)
     d->m_doc->close();
 }
Index: khtml/khtmlpart_p.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/khtmlpart_p.h,v
retrieving revision 1.15
retrieving revision 1.15.6.1
diff -u -r1.15 khtml/khtmlpart_p.h
--- khtml/khtmlpart_p.h	2002/12/17 08:08:55	1.15
+++ khtmlpart_p.h	2003/01/14 21:23:55	1.15.6.1
@@ -106,6 +106,7 @@
     m_job = 0L;
     m_bComplete = true;
     m_bLoadEventEmitted = true;
+    m_bUnloadEventEmitted = true;
     m_cachePolicy = KIO::CC_Verify;
     m_manager = 0L;
     m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
@@ -251,6 +252,7 @@
 
   bool m_bComplete:1;
   bool m_bLoadEventEmitted:1;
+  bool m_bUnloadEventEmitted:1;
   bool m_haveEncoding:1;
   bool m_bHTTPRefresh:1;
   bool m_onlyLocalReferences :1;
