[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: patch : crash on "close all views"
From:       David Faure <dfaure () klaralvdalens-datakonsult ! se>
Date:       2003-05-27 9:03:36
[Download RAW message or body]

On Saturday 24 May 2003 21:19, Ariya Hidayat wrote:
> 
> > Please put "diff -up" in your ~/.cvsrc ...
> 
> The patch for koMainWindow.cc now looks like this:
> 
> @@ -1283,21 +1283,21 @@ void KoMainWindow::slotCloseAllViews() {
>       // Attention: Very touchy code... you know what you're doing? Goooood :)
>       d->m_forQuit=true;
>       if(queryClose()) {
> -        hide();
> -        d->m_rootDoc->removeShell(this);
>           // In case the document is embedded we close all open "extra-shells"
>           if(d->m_rootDoc && d->m_rootDoc->isEmbedded()) {
> +            hide();
> +            d->m_rootDoc->removeShell(this);
>               QPtrListIterator<KoMainWindow> it(d->m_rootDoc->shells());
>               while (it.current()) {
>                   it.current()->hide();
>                   delete it.current(); // this updates the lists' current pointer and thus
>                                        // the iterator (the shell dtor calls removeShell)
> +            d->m_rootDoc=0;
>               }
>           }
>           // not embedded -> destroy the document and all shells/views ;)
>           else
> -            delete d->m_rootDoc;
> -        d->m_rootDoc=0;
> +	    setRootDocument( 0L );
>           close();  // close this window (and quit the app if necessary)
>       }
>       d->m_forQuit=false;

Difficult to proof-read without debugging it myself. I'll trust you that it works :)
Werner wrote this code, I was hoping he would be able to react on this...
Feel free to commit.

-- 
David Faure -- faure@kde.org, dfaure@klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic