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

List:       koffice-devel
Subject:    Re: dockers constructors
From:       "Peter Simonsson" <peter.simonsson () gmail ! com>
Date:       2007-11-04 11:41:07
Message-ID: 9966b3040711040341y445d80i7482fd9fb448826b () mail ! gmail ! com
[Download RAW message or body]

2007/11/3, Thomas Zander <zander@kde.org>:
> Hi,
>
> I just got a bugreport that kpresenter crashes by doing the following;
> * start kpresenter
> * select template and 'use'
> * close doc (ctrl-w, leave window open!)
> * select template and 'use'
>
> Looking at the backtrace the problem seems to be that the
> KoPADocumentStructureDocker is trying to do something on a non existing
> shape.
> Looking at the code I see that there is a document pointer being passed
> into the dockers constructor.  This is conceptually wrong and explains at
> least half of the crash.
>
> Dockers should never be passed a document or a view in the constructor.
> The reasons for that is simple; the lifetime of the docker is longer then
> the lifetime of the document and also of the view.
>
> The proper way to do this is to let the application tell you there is a
> new document or a new image / etc. And listen on that.
> This involves a couple of steps.
> * The application should use the KoCanvasResourceProvider to put content
> on. Like the current layer, the current document etc.
> * The docker should (also) inherit from KoCanvasObserver which means it
> will get notified when its canvas changes.
> * Using the KoCanvasBase received from the KoCanvasObserver it can fetch
> the document from the KoCanvasResourceProvider.  It can also connect to
> the provider to be informed about any changes.
>
> An extra tip is to use the KoCanvasResource::DocumentIsLoading boolean.
> * Applications should set/unset the boolean in the resourceProvider (KWord
> already does).
> * Dockers/etc should listen to it to avoid doing work while the document
> is loading.
>
> Can someone fix the crash in KPresenter/Kivio by refactoring the
> KoPADocumentStructureDocker as suggested above?
> Thanks!
> --
> Thomas Zander
>

KoPADocumentStructureDocker uses KoCanvasObserver now so it doesn't
seem to crash anymore at least... I'll look into the rest of the
suggestions now.
-- 
LLaP
Peter Simonsson
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://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