Review Request 113664: Properly destruct added KoPageWidgetItems on destruction of KoDocumentInfoDlg

Friedrich W. H. Kossebau kossebau at kde.org
Thu Nov 7 09:53:15 GMT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/113664/
-----------------------------------------------------------

(Updated Nov. 7, 2013, 9:53 a.m.)


Status
------

This change has been marked as submitted.


Review request for Calligra and Boudewijn Rempt.


Repository: calligra


Description
-------

Fixes crash when semantic items are inserted after the dialog incl. the rdf page was shown & closed

Seems that KoDocumentInfoDlg is slightly flawed after the port to KPageDialog :/
For one KPageWidgetItem* are collected in d->pages ("item" vs. "page"), which then are tried to be casted to KoPageWidgetItem*, which is bogus because KoPageWidgetItem is not in any relationship with KPageWidgetItem anymore.

The initial plan was to make KoPageWidgetItem simply a subclass of KPageWidgetItem. But that has the problem that KPageWidgetItem expects its mainwidget to be passed in the constructor call, so in constructor code of subclasses right here: KoPageWidgetItem::KoPageWidgetItem(...) : KPageWidgetItem(widget) {...}.
Means, subclasses which would like to be complete page items  setting the widget themselves (like the KoDocumentRdfEditWidget) would have to do some tricks to get their widget already available on call to the baseclass constructor.
Somehow messy.

So decided to just do a quick fix for now, by adding a simple adapter/wrapper class, which makes sure that the KoPageWidgetItem is deleted on destruction and that any calls on the KoPageWidgetItem API after casting will happen actually again.

Hopefully this dialog will be redone in calligra 3.0 (qt5/kf5) properly. Or KoDocumentRdfEditWidget might get a refactoring and things could be done differently, as that is the only calligra-internal page-extension currently.

Okay to also backport to 2.7?


Diffs
-----

  libs/main/KoDocumentInfoDlg.cpp a8466c1 

Diff: http://git.reviewboard.kde.org/r/113664/diff/


Testing
-------

No more crashes happening when semantic items are inserted after the dialog incl. the rdf page was shown & closed


Thanks,

Friedrich W. H. Kossebau

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20131107/4cb3e181/attachment.htm>


More information about the calligra-devel mailing list