| Summary: | automatic formatting of URLs crash KWord | ||
|---|---|---|---|
| Product: | [Unmaintained] kword | Reporter: | Lasse Liehu <lasse.liehu> |
| Component: | general | Assignee: | Thomas Zander <zander> |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | CC: | liam |
| Priority: | NOR | ||
| Version First Reported In: | 1.6.1 | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Lasse Liehu
2007-01-11 06:21:33 UTC
SVN commit 622286 by dfaure:
Fix crash when autocorrect-urls replaces a url with a link
(replaceSelectionCommand wants no placeholder command but insert assumed there was one at some point)
BUG: 139890
I see now that this is the same crash as the one in 126428 and 127771, which got fixed in 1.5, but I guess that bugfix didn't get forwardported out of the 1.5 branch :{
CCBUG: 126428, 127771
M +20 -16 KoTextObject.cpp
--- branches/koffice/1.6/koffice/lib/kotext/KoTextObject.cpp #622285:622286
@@ -262,7 +262,7 @@
bool KoTextObject::UndoRedoInfo::valid() const
{
- return text.length() > 0 && id >= 0 && index >= 0;
+ return text.length() > 0 && id >= 0 && index >= 0 && type != Invalid;
}
void KoTextObject::UndoRedoInfo::clear()
@@ -276,23 +276,26 @@
KoTextDocCommand * cmd = new KoTextInsertCommand( textdoc, id, index, text.rawData(), customItemsMap, oldParagLayouts );
textdoc->addCommand( cmd );
Q_ASSERT( placeHolderCmd );
- // Inserting any custom items -> macro command, to let custom items add their command
- if ( !customItemsMap.isEmpty() )
+ if ( placeHolderCmd ) // crash prevention
{
- CustomItemsMap::Iterator it = customItemsMap.begin();
- for ( ; it != customItemsMap.end(); ++it )
+ // Inserting any custom items -> macro command, to let custom items add their command
+ if ( !customItemsMap.isEmpty() )
{
- KoTextCustomItem * item = it.data();
- KCommand * itemCmd = item->createCommand();
- if ( itemCmd )
- placeHolderCmd->addCommand( itemCmd );
+ CustomItemsMap::Iterator it = customItemsMap.begin();
+ for ( ; it != customItemsMap.end(); ++it )
+ {
+ KoTextCustomItem * item = it.data();
+ KCommand * itemCmd = item->createCommand();
+ if ( itemCmd )
+ placeHolderCmd->addCommand( itemCmd );
+ }
+ placeHolderCmd->addCommand( new KoTextCommand( textobj, /*cmd, */QString::null ) );
}
- placeHolderCmd->addCommand( new KoTextCommand( textobj, /*cmd, */QString::null ) );
+ else
+ {
+ placeHolderCmd->addCommand( new KoTextCommand( textobj, /*cmd, */QString::null ) );
+ }
}
- else
- {
- placeHolderCmd->addCommand( new KoTextCommand( textobj, /*cmd, */QString::null ) );
- }
} break;
case Delete:
case RemoveSelected:
@@ -319,7 +322,7 @@
index = -1;
oldParagLayouts.clear();
customItemsMap.clear();
- placeHolderCmd = 0L;
+ placeHolderCmd = 0;
}
void KoTextObject::copyCharFormatting( KoTextParag *parag, int position, int index /*in text*/, bool moveCustomItems )
@@ -722,7 +725,8 @@
if ( textdoc->removeSelection( selectionId ) && repaint )
selectionChangedNotify(); // does the repaint
}
- if ( !customItemsMap.isEmpty() ) {
+ if ( !customItemsMap.isEmpty()
+ && !commandName.isNull() /* see replace-selection; #139890 */ ) {
clearUndoRedoInfo();
}
*** Bug 141605 has been marked as a duplicate of this bug. *** |