D13905: Fix KTextEditor::MainWindow to outlive the KTextEditor::View objects
Friedrich W. H. Kossebau
noreply at phabricator.kde.org
Thu Jul 5 19:14:33 BST 2018
kossebau created this revision.
kossebau added reviewers: KDevelop, croick, mwolff.
Restricted Application added a project: KDevelop.
Restricted Application added a subscriber: kdevelop-devel.
kossebau requested review of this revision.
REVISION SUMMARY
The KTextEditor::MainWindow API requires that the MainWindow wrapper
object passed to the created KTextEditor::View objects "stays valid
for the complete lifetime of the view."
The old code had Shell::MainWindow own the MainWindow wrapper
object as child object, thus deleting as part of its own destruction.
Though any KTextEditor::View objects still alive are being deleted
with deleteLater(), so only destructed on the next QEvent::DeferredDelete
handling. And they still assume they can access the MainWindow wrapper
during their shutdown as normal, e.g. to call "MainWindow::deleteViewBar".
To get things into some proper order again, this patch adds a method
KTextEditorIntegration::MainWindow::startDestroy(), which now is called
in the destruction of Shell::MainWindow instead of instantly deleting the
MainWindow wrapper object as normal child object. The method starts a
delayed delete instead, to outlive any TextEditor::View objects
being deleteLatered() inside the Core::self()->shutdown().
KTextEditorIntegration::MainWindow also gets fixed to know about the
state of being destroyed and in that case no longer do things on the
former mainwindow object.
The patch also moves the layout code for stacking the viewbars into a
new special class Sublime::ViewBarContainer. That solves lifetime and
ownership handling of the widget and the layout, and hides the
implementation detail behind a simple API.
While this makes viewBarContainer() no longer a simple plain widget
to be customized by any caller, no other user is known which would need
that.
REPOSITORY
R32 KDevelop
BRANCH
delaykatewrapperdelete
REVISION DETAIL
https://phabricator.kde.org/D13905
AFFECTED FILES
kdevplatform/shell/ktexteditorpluginintegration.cpp
kdevplatform/shell/ktexteditorpluginintegration.h
kdevplatform/shell/mainwindow.cpp
kdevplatform/sublime/CMakeLists.txt
kdevplatform/sublime/mainwindow.cpp
kdevplatform/sublime/mainwindow.h
kdevplatform/sublime/mainwindow_p.cpp
kdevplatform/sublime/mainwindow_p.h
kdevplatform/sublime/viewbarcontainer.cpp
kdevplatform/sublime/viewbarcontainer.h
To: kossebau, #kdevelop, croick, mwolff
Cc: kdevelop-devel, antismap, iodelay, vbspam, njensen, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180705/5bea56b4/attachment.html>
More information about the KDevelop-devel
mailing list