mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix the infinite loop when automatically closing the view after a on_lastWorkAreaRemoved() signal was received.
In this case, all workareas are closed, but the tabworkarea still exists. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30521 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e9d19b82d4
commit
1bce8f15af
@ -538,12 +538,21 @@ void GuiView::closeEvent(QCloseEvent * close_event)
|
|||||||
GuiWorkArea * active_wa = currentMainWorkArea();
|
GuiWorkArea * active_wa = currentMainWorkArea();
|
||||||
setCurrentWorkArea(active_wa);
|
setCurrentWorkArea(active_wa);
|
||||||
|
|
||||||
|
// We might be in a situation that there is still a tabWorkArea, but
|
||||||
|
// there are no tabs anymore. This can happen when we get here after a
|
||||||
|
// TabWorkArea::lastWorkAreaRemoved() signal. Therefore we count how
|
||||||
|
// many TabWorkArea's have no documents anymore.
|
||||||
|
int empty_twa = 0;
|
||||||
|
|
||||||
// We have to call count() each time, because it can happen that
|
// We have to call count() each time, because it can happen that
|
||||||
// more than one splitter will disappear in one iteration (bug 5998).
|
// more than one splitter will disappear in one iteration (bug 5998).
|
||||||
for (; d.splitter_->count(); ) {
|
for (; d.splitter_->count() > empty_twa; ) {
|
||||||
TabWorkArea * twa = d.tabWorkArea(0);
|
TabWorkArea * twa = d.tabWorkArea(empty_twa);
|
||||||
|
|
||||||
int twa_count = twa->count();
|
int twa_count = twa->count();
|
||||||
|
if (twa->count() == 0)
|
||||||
|
++empty_twa;
|
||||||
|
|
||||||
for (; twa_count; --twa_count) {
|
for (; twa_count; --twa_count) {
|
||||||
twa->setCurrentIndex(twa_count-1);
|
twa->setCurrentIndex(twa_count-1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user