[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: dockers constructors
From: Thomas Zander <zander () kde ! org>
Date: 2007-11-03 20:42:05
Message-ID: 200711032142.05773.zander () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
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
[Attachment #5 (application/pgp-signature)]
_______________________________________________
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