<table><tr><td style="">kossebau created this revision.<br />kossebau added reviewers: KDevelop, croick, mwolff.<br />Restricted Application added a project: KDevelop.<br />Restricted Application added a subscriber: kdevelop-devel.<br />kossebau requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D13905">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The KTextEditor::MainWindow API requires that the MainWindow wrapper<br />
object passed to the created KTextEditor::View objects "stays valid<br />
for the complete lifetime of the view."</p>
<p>The old code had Shell::MainWindow own the MainWindow wrapper<br />
object as child object, thus deleting as part of its own destruction.<br />
Though any KTextEditor::View objects still alive are being deleted<br />
with deleteLater(), so only destructed on the next QEvent::DeferredDelete<br />
handling. And they still assume they can access the MainWindow wrapper<br />
during their shutdown as normal, e.g. to call "MainWindow::deleteViewBar".</p>
<p>To get things into some proper order again, this patch adds a method<br />
KTextEditorIntegration::MainWindow::startDestroy(), which now is called<br />
in the destruction of Shell::MainWindow instead of instantly deleting the<br />
MainWindow wrapper object as normal child object. The method starts a<br />
delayed delete instead, to outlive any TextEditor::View objects<br />
being deleteLatered() inside the Core::self()->shutdown().</p>
<p>KTextEditorIntegration::MainWindow also gets fixed to know about the<br />
state of being destroyed and in that case no longer do things on the<br />
former mainwindow object.</p>
<p>The patch also moves the layout code for stacking the viewbars into a<br />
new special class Sublime::ViewBarContainer. That solves lifetime and<br />
ownership handling of the widget and the layout, and hides the<br />
implementation detail behind a simple API.<br />
While this makes viewBarContainer() no longer a simple plain widget<br />
to be customized by any caller, no other user is known which would need<br />
that.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>BRANCH</strong><div><div>delaykatewrapperdelete</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D13905">https://phabricator.kde.org/D13905</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>kdevplatform/shell/ktexteditorpluginintegration.cpp<br />
kdevplatform/shell/ktexteditorpluginintegration.h<br />
kdevplatform/shell/mainwindow.cpp<br />
kdevplatform/sublime/CMakeLists.txt<br />
kdevplatform/sublime/mainwindow.cpp<br />
kdevplatform/sublime/mainwindow.h<br />
kdevplatform/sublime/mainwindow_p.cpp<br />
kdevplatform/sublime/mainwindow_p.h<br />
kdevplatform/sublime/viewbarcontainer.cpp<br />
kdevplatform/sublime/viewbarcontainer.h</div></div></div><br /><div><strong>To: </strong>kossebau, KDevelop, croick, mwolff<br /><strong>Cc: </strong>kdevelop-devel, antismap, iodelay, vbspam, njensen, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>