Bug 48999 - crash on replacing KWord forward newline selection with horizontal space
Summary: crash on replacing KWord forward newline selection with horizontal space
Status: RESOLVED FIXED
Alias: None
Product: kword
Classification: Miscellaneous
Component: general (show other bugs)
Version: 1.5 or before
Platform: Mandrake RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: Thomas Zander
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-11 01:38 UTC by Stephen Compall
Modified: 2004-05-17 21:27 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 Stephen Compall 2002-10-11 01:38:45 UTC
Version:           1.2 (using KDE KDE 3.0.3)
Installed from:    Mandrake RPMs
Compiler:          GCC 3.2 
OS:          Linux

No backtraces w/ RPMs. It's easy to reproduce, though:

1. Open new KWord doc
2. type a newline, then some text and/or spaces
3. go back to the first line, select the newline forward, and type a space or tab (thus replacing the newline)
4. core dumped

I encountered this error removing some spacing from the FDL notice, FYI :)

This bug *does not* manifest itself if you select the newline backwards (that is, the cursor is on the first line), if you don't use a horizontal spacing character, or if there is no text on the second line (though if there are spaces, it still crashes).
Comment 1 David Faure 2003-04-02 12:15:53 UTC
Subject: koffice/lib/kotext

CVS commit by faure: 

Fix crash due to autoformat using a stale paragraph pointer
CCMAIL: 48999-done@bugs.kde.org


  M +2 -2      kotextview.cc   1.107


--- koffice/lib/kotext/kotextview.cc  #1.106:1.107
@@ -330,6 +330,6 @@ void KoTextView::handleKeyPressEvent( QK
                     {
                         insertText( text );
-
-                        doAutoFormat( m_cursor, p, m_cursor->index() - 1, text[ text.length() - 1 ] );
+                        // Don't use 'p' past this point. If we replaced a selection, p could have been deleted (#48999)
+                        doAutoFormat( m_cursor, m_cursor->parag(), m_cursor->index() - 1, text[ text.length() - 1 ] );
                     }
                 }