[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kate/part
From:       Joseph Wenninger <kde () jowenn ! at>
Date:       2005-01-31 23:17:33
Message-ID: 20050131231733.69BE71D1DF () office ! kde ! org
[Download RAW message or body]

CVS commit by jowenn: 

an attempt to fix #96327


  M +15 -2     katefactory.cpp   1.71


--- kdelibs/kate/part/katefactory.cpp  #1.70:1.71
@@ -34,4 +34,5 @@
 #include <kdirwatch.h>
 #include <kstaticdeleter.h>
+#include <qapplication.h>
 
 /**
@@ -145,4 +146,16 @@ KateFactory::KateFactory ()
 KateFactory::~KateFactory()
 {
+  /* ?hack? If  MainApplication-Interface::quit is called by dcop the factory gets \
destroyed before all documents are destroyed eg in kwrite. +  This could happen in \
other apps too. Since the documents try to unregister a new factory is created (in \
the ::self call) and registered with a  +  KStaticDeleter which causes a crash. \
That's why I ensure here that all documents are destroyed before the factory goes \
down (JOWENN)*/ +  while (KateDocument *doc=m_documents.first()) {
+    s_self=this; /* this is needed because the KStaticDeleter sets the global \
reference to 0, before it deletes the object it handles. +    To prevent a crash \
again restore the factory pointer temporarily. (jowenn)*/ +    delete doc;
+    s_self=0;
+  }
+  /*another solution would be to set a flag in the documents, and inhibit calling of \
the deregistering methods, but I don't see a problem +  if all created objects are \
deleted before their factory. If somebody sees a problem, let me know*/ +  
   delete m_documentConfig;
   delete m_viewConfig;
@@ -164,7 +177,7 @@ static KStaticDeleter<KateFactory> sdFac
 KateFactory *KateFactory::self ()
 {
-  if (!s_self)
+  if (!s_self) {
     sdFactory.setObject(s_self, new KateFactory ());
-
+  }
   return s_self;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic