Bug 67494 - crash on exit after editing chat style
Summary: crash on exit after editing chat style
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Main Application (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-07 11:46 UTC by Will Stephenson
Modified: 2003-11-17 18:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Will Stephenson 2003-11-07 11:46:11 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Aah!  A crazed bug reporting robot has escaped from Bille's lab!  I wish.

May be related to #67490. Kopete crashes on exit after trying to edit a chat style.  The katepart must be getting tidied up wrongly - look at #9-#11 : 

#3  <signal handler called>
#4  0x417e5dc1 in QGList::find(void*, bool) (this=0x0, d=0x40c90454, 
    fromStart=true) at tools/qglist.cpp:745
#5  0x410d2799 in QPtrList<KStaticDeleterBase>::find(KStaticDeleterBase const*)
    (this=0x0, d=0x40c90454) at qptrlist.h:95
#6  0x410d2540 in KGlobal::registerStaticDeleter(KStaticDeleterBase*) (
    obj=0x40c90454)
    at /home/will/projects/kde/src/kdelibs/kdecore/kglobal.cpp:170
#7  0x40b166af in KStaticDeleter<KTrader>::setObject(KTrader*&, KTrader*, bool)
    (this=0x40c90454, globalRef=@0x40c90450, obj=0x8271f98, isArray=false)
    at kstaticdeleter.h:101
#8  0x40b15b1f in KTrader::self() ()
    at /home/will/projects/kde/src/kdelibs/kio/kio/ktrader.cpp:92
#9  0x42c61038 in KateFactory (this=0x8480b50)
    at /home/will/projects/kde/src/kdelibs/kate/part/katefactory.cpp:113
#10 0x42c61483 in KateFactory::self() ()
    at /home/will/projects/kde/src/kdelibs/kate/part/katefactory.cpp:152
#11 0x42c49059 in ~KateDocument (this=0x83f9ac8)
    at /home/will/projects/kde/src/kdelibs/kate/part/katedocument.cpp:313
#12 0x40ed0f37 in QPtrList<QObject>::deleteItem(void*) (this=0x83d6938, 
    d=0x83f9ac8) at qptrlist.h:150
#13 0x417e5cf7 in QGList::clear() (this=0x83d6938) at tools/qglist.cpp:701
#14 0x40ed0d18 in QPtrList<QObject>::clear() (this=0x83d6938) at qptrlist.h:93
#15 0x410de139 in ~KLibrary (this=0x83d6900)
    at /home/will/projects/kde/src/kdelibs/kdecore/klibloader.cpp:136
#16 0x410dfde6 in KLibLoader::close_pending(KLibWrapPrivate*) (this=0x8224d00, 
    wrap=0x83c91c0)
    at /home/will/projects/kde/src/kdelibs/kdecore/klibloader.cpp:521
#17 0x410df277 in ~KLibLoader (this=0x8224d00)
    at /home/will/projects/kde/src/kdelibs/kdecore/klibloader.cpp:338
#18 0x410debaf in KLibLoader::cleanUp() ()
Comment 1 Martijn Klingens 2003-11-07 12:37:31 UTC
Subject: Re: [Kopete-devel]  New: crash on exit after editing chat style

On Friday 07 November 2003 11:46, Will Stephenson wrote:
> May be related to #67490. Kopete crashes on exit after trying to edit a chat
> style.  The katepart must be getting tidied up wrongly - look at #9-#11 : 

That, or a double deletion. Valgrind should tell you which of the two.

Comment 2 Will Stephenson 2003-11-07 12:53:07 UTC
Subject: Re:  crash on exit after editing chat style

On Friday 07 November 2003 11:37, you wrote:
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
> http://bugs.kde.org/show_bug.cgi?id=67494
>
>
>
>
> ------- Additional Comments From klingens@kde.org  2003-11-07 12:37 -------
> Subject: Re: [Kopete-devel]  New: crash on exit after editing chat style
>
> On Friday 07 November 2003 11:46, Will Stephenson wrote:
> > May be related to #67490. Kopete crashes on exit after trying to edit a
> > chat style.  The katepart must be getting tidied up wrongly - look at
> > #9-#11 :
>
> That, or a double deletion. Valgrind should tell you which of the two.

I think so too, I'm hoping Jason will feel compelled to go clean up his hacks.

How's it going anyway?  Surviving at work?

Will
Comment 3 Will Stephenson 2003-11-07 13:14:30 UTC
Jason, sorry, but these are not your hacks.  My bad.

Will
Comment 4 Matt Rogers 2003-11-11 16:50:51 UTC
needs to be fixed before 3.2
Comment 5 Olivier Goffart 2003-11-12 20:03:37 UTC
Subject: kdenetwork/kopete/kopete/config/appearance

CVS commit by ogoffart: 

Fix Bug 67494: crash on exit after editing chat style

CCMAIL: 67494-done@bugs.kde.org


  M +21 -13    appearanceconfig.cpp   1.14
  M +1 -1      appearanceconfig.h   1.3


--- kdenetwork/kopete/kopete/config/appearance/appearanceconfig.cpp  #1.13:1.14
@@ -489,6 +489,6 @@ void AppearanceConfig::slotDeleteStyle()
 void AppearanceConfig::slotStyleSaved()
 {
-        addStyle( styleEditor->styleName->text(), KTextEditor::editInterface( editDocument )->text() );
-
+        if( addStyle( styleEditor->styleName->text(), KTextEditor::editInterface( editDocument )->text() ) )
+        {
         // Remove our tempfile
         QString filePath = itemMap[ editedItem ];
@@ -499,12 +499,16 @@ void AppearanceConfig::slotStyleSaved()
         }
         delete editedItem;
+                editedItem=0L;
 
         styleEditor->deleteLater();
         emit changed( true );
+        }
+        else //The style has not been saved for a reason or another - don't loose it
+                styleEditor->show();
 }
 
-void AppearanceConfig::addStyle( const QString &styleName, const QString &styleSheet )
+bool AppearanceConfig::addStyle( const QString &styleName, const QString &styleSheet )
 {
-        if( !mPrfsChatWindow->styleList->findItem( styleName ) )
+        if( !mPrfsChatWindow->styleList->findItem( styleName )  ||  (mPrfsChatWindow->styleList->selectedItem() && mPrfsChatWindow->styleList->selectedItem()->text()==styleName)  )
         {
                 QString filePath = locateLocal("appdata", QString::fromLatin1("styles/%1.xsl").arg( styleName ) );
@@ -521,4 +525,5 @@ void AppearanceConfig::addStyle( const Q
                         mPrfsChatWindow->styleList->sort();
                         styleChanged = true;
+                        return true;
                 }
                 else
@@ -531,4 +536,7 @@ void AppearanceConfig::addStyle( const Q
                 KMessageBox::queuedMessageBox( this, KMessageBox::Error, i18n("A style named \"%1\" already exists. Please rename the style.").arg( styleName ), i18n("Could Not Save") );
         }
+
+        //The style has not been saved for a reason or another
+        return false;
 }
 

--- kdenetwork/kopete/kopete/config/appearance/appearanceconfig.h  #1.2:1.3
@@ -104,5 +104,5 @@ private:
         void updateHighlight();
         QString fileContents(const QString &path);
-        void addStyle(const QString &styleName, const QString &xslString);
+        bool addStyle(const QString &styleName, const QString &xslString);
 
         KopeteAppearanceConfigPrivate *d;


Comment 6 Olivier Goffart 2003-11-12 20:19:25 UTC
Sorry, This commit was not supposed to close this bug, it was supposed to fix the Bug 67490
Sorry agian.
Comment 7 Olivier Goffart 2003-11-17 18:18:48 UTC
Subject: kdenetwork/kopete/kopete/config/appearance

CVS commit by ogoffart: 

Here is one fix for the bug 67494 (crash on exit after editing chat style)
CCMAIL: 67494-done@bugs.kde.org

Looks the FIXME in the code for more information 


  M +10 -0     appearanceconfig.cpp   1.15


--- kdenetwork/kopete/kopete/config/appearance/appearanceconfig.cpp  #1.14:1.15
@@ -350,4 +350,14 @@ void AppearanceConfig::slotAddStyle()
         if(!editDocument)
                 return; //TODO: show an error if the plugin can't be loaded
+
+        //FIXME:  Can someone explain me why editDocument has no parents.  Is it a problem in Kate? in the KLibrary system?
+        //    This is a workaround for that.  That solve also a crash while closing kopete
+        connect( styleEditor , SIGNAL(destroyed()) , editDocument,  SLOT(deleteLater()) );
+        //    Explaination of the crash (Bug 67494) :
+        //     There is a static deleter in the Kate KPart to free some classes. This one deelte also some Highligh object.
+        //     And There is another staticDeleter in Kopete to free the LibLoader, which will free the Kate Library, which will delete
+        //     the Kate's Document, which will deref some Highlight object ***BOUM***  (Highlight objects are already deleted)
+        //     So this is maybe a problem in Kate. But if we delte object before closig kopete, when they are not usefull anymore, no problem
+
         editDocument->createView( styleEditor->editFrame, 0 )->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding) );
         KTextEditor::editInterface( editDocument )->setText( QString::fromLatin1(