Summary: | crash on exit after editing chat style | ||
---|---|---|---|
Product: | [Applications] kopete | Reporter: | Will Stephenson <wstephenson> |
Component: | Main Application | Assignee: | Kopete Developers <kopete-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Will Stephenson
2003-11-07 11:46:11 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.
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 Jason, sorry, but these are not your hacks. My bad. Will needs to be fixed before 3.2 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; Sorry, This commit was not supposed to close this bug, it was supposed to fix the Bug 67490 Sorry agian. 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( |