Index: contents.cc =================================================================== RCS file: /home/kde/koffice/kword/contents.cc,v retrieving revision 1.49.2.1 retrieving revision 1.49.2.2 diff -u -p -r1.49.2.1 -r1.49.2.2 --- contents.cc 18 Oct 2002 16:59:42 -0000 1.49.2.1 +++ contents.cc 20 Dec 2002 12:01:36 -0000 1.49.2.2 @@ -134,7 +134,7 @@ KoTextCursor * KWInsertTOCCommand::remov // We start from the end, to avoid the parag shifting problem KoTextParag *p = textdoc->lastParag(); KoTextCursor *posOfTable=0L; - KWTextParag *posOfToc=0L; + KoTextParag *posOfToc=0L; while ( p ) { @@ -142,8 +142,6 @@ KoTextCursor * KWInsertTOCCommand::remov if ( parag->style() && ( parag->style()->name().startsWith( "Contents Head" ) || parag->style()->name() == "Contents Title" ) ) { - posOfToc=parag; - kdDebug() << "KWContents::createContents Deleting paragraph " << p << " " << p->paragId() << endl; // This paragraph is part of the TOC -> remove @@ -172,6 +170,7 @@ KoTextCursor * KWInsertTOCCommand::remov delete p; kdDebug() << "KWInsertTOCCommand::removeTOC " << p << " deleted" << endl; p = next; + posOfToc = p; kdDebug() << "KWInsertTOCCommand::removeTOC prev=" << prev << " p=" << p << endl; // Fix parag chain if ( prev ) @@ -179,6 +178,8 @@ KoTextCursor * KWInsertTOCCommand::remov prev->setNext( p ); if ( p ) p->setParagId( prev->paragId() + 1 ); + else + posOfToc = prev; } else { @@ -190,6 +191,7 @@ KoTextCursor * KWInsertTOCCommand::remov { textdoc->clear( true ); // recreate empty parag. cursor->setParag( textdoc->firstParag() ); + posOfToc = textdoc->firstParag(); break; } } @@ -198,12 +200,12 @@ KoTextCursor * KWInsertTOCCommand::remov p = p->prev(); } textdoc->invalidate(); - if(posOfToc) - { + if(posOfToc) + { posOfTable=new KoTextCursor( textdoc ); posOfTable->setParag(posOfToc ); posOfTable->setIndex( 0 );//start of parag - } + } // ### TODO propagate parag ID changes. return posOfTable; } Index: kwview.cc =================================================================== RCS file: /home/kde/koffice/kword/kwview.cc,v retrieving revision 1.822.2.5 retrieving revision 1.822.2.6 diff -u -p -r1.822.2.5 -r1.822.2.6 --- kwview.cc 12 Nov 2002 15:38:17 -0000 1.822.2.5 +++ kwview.cc 24 Dec 2002 15:16:50 -0000 1.822.2.6 @@ -251,12 +251,6 @@ KWView::KWView( KWViewMode* viewMode, QW KWView::~KWView() { clearSelection(); - //delete special char dlg when we close view - if ( m_specialCharDlg ) - { - m_specialCharDlg->closeDialog(); - } - if ( m_findReplace ) { // Abort any find/replace @@ -322,8 +316,11 @@ void KWView::clearSelection() delete m_spell.kspell; } delete m_searchEntry; + m_searchEntry = 0L; delete m_replaceEntry; - delete m_specialCharDlg; + m_replaceEntry = 0L; + if ( m_specialCharDlg ) + m_specialCharDlg->closeDialog(); // will call slotSpecialCharDlgClosed } @@ -3079,7 +3076,7 @@ void KWView::slotSpecialCharDlgClosed() this, SLOT(slotSpecialChar(QChar,const QString &))); disconnect( m_specialCharDlg, SIGNAL( finished() ), this, SLOT( slotSpecialCharDlgClosed() ) ); - delete m_specialCharDlg; + m_specialCharDlg->deleteLater(); m_specialCharDlg = 0L; } }