[PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
The reason is that closing a Buffer triggers an update of all opened dialogs when dispatching LFUN_DIALOG_UPDATE (hence the patch). The path is as following: setBuffer() - updateBufferDependent() - RestoreButton() - LFUN The problem here is that the Toc dialog has not been reconstructed (because it comes after in the list of dialogs). This patch should definitely go _before_ 1.5.0; OK? Abdel. Index: LyXFunc.cpp === --- LyXFunc.cpp (revision 19003) +++ LyXFunc.cpp (working copy) @@ -1838,8 +1838,10 @@ } } if (!quitting) { - lyx_view_-updateMenubar(); - lyx_view_-updateToolbars(); + if (cmd.action != LFUN_DIALOG_UPDATE) { + lyx_view_-updateMenubar(); + lyx_view_-updateToolbars(); + } // Some messages may already be translated, so we cannot use _() sendDispatchMessage(translateIfPossible(getMessage()), cmd); }
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
Abdelrazak == Abdelrazak Younes [EMAIL PROTECTED] writes: Abdelrazak The problem here is that the Toc dialog has not been Abdelrazak reconstructed (because it comes after in the list of Abdelrazak dialogs). Abdelrazak This patch should definitely go _before_ 1.5.0; OK? I understand that we need to fix that before 1.5.0 and that this is the easiest route, but in general I'd rather avoid to add explicit tests against LFUNS like this one. (not that I have a better solution at hand...). JMarc
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
Jean-Marc Lasgouttes wrote: Abdelrazak == Abdelrazak Younes [EMAIL PROTECTED] writes: Abdelrazak The problem here is that the Toc dialog has not been Abdelrazak reconstructed (because it comes after in the list of Abdelrazak dialogs). Abdelrazak This patch should definitely go _before_ 1.5.0; OK? I understand that we need to fix that before 1.5.0 and that this is the easiest route, but in general I'd rather avoid to add explicit tests against LFUNS like this one. (not that I have a better solution at hand...). I agree and I will offer a better solution after 1.5.0 is out. They are several alternatives at hand but this patch is easiest and the safest for now. Abdel.
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
Jean-Marc Lasgouttes wrote: Abdelrazak == Abdelrazak Younes [EMAIL PROTECTED] writes: Abdelrazak The problem here is that the Toc dialog has not been Abdelrazak reconstructed (because it comes after in the list of Abdelrazak dialogs). Abdelrazak This patch should definitely go _before_ 1.5.0; OK? I understand that we need to fix that before 1.5.0 and that this is the easiest route, but in general I'd rather avoid to add explicit tests against LFUNS like this one. (not that I have a better solution at hand...). Here is an alternative patch. I don't like it because this means that the Toc dialog will be rebuilt twice. But I'll put it in if you prefer. Longer term, we probably need to add some new properties to the LFUNs like the new clearSelection one. Abdel. Index: LyXView.cpp === --- LyXView.cpp (revision 19003) +++ LyXView.cpp (working copy) @@ -163,6 +163,18 @@ connectBuffer(*newBuffer); + /* FIXME: Rebuild the Toc dialog before the others even if it + will be rebuilt again in the next line. This avoid a crash when + other dialogs are rebuilt before the Toc dialog. The reason is + that closing a Buffer triggers an update of all opened dialogs + when dispatching LFUN_DIALOG_UPDATE (hence the patch). + The path is as following: + setBuffer() - updateBufferDependent() - RestoreButton() - LFUN + + The problem here is that the Toc dialog has not been + reconstructed (because it comes after in the list of dialogs). */ + updateToc(); + // Buffer-dependent dialogs should be updated or // hidden. This should go here because some dialogs (eg ToC) // require bv_-text. @@ -462,7 +474,7 @@ } BOOST_ASSERT(work_area_); - string const layout = work_area_-bufferView().cursor(). + docstring const layout = work_area_-bufferView().cursor(). innerParagraph().layout()-name(); if (layout != current_layout) {
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
Abdelrazak Younes wrote: Jean-Marc Lasgouttes wrote: Abdelrazak == Abdelrazak Younes [EMAIL PROTECTED] writes: Abdelrazak The problem here is that the Toc dialog has not been Abdelrazak reconstructed (because it comes after in the list of Abdelrazak dialogs). Abdelrazak This patch should definitely go _before_ 1.5.0; OK? I understand that we need to fix that before 1.5.0 and that this is the easiest route, but in general I'd rather avoid to add explicit tests against LFUNS like this one. (not that I have a better solution at hand...). Here is an alternative patch. The part below was not meant to be in the patch, please ignore: @@ -462,7 +474,7 @@ } BOOST_ASSERT(work_area_); - string const layout = work_area_-bufferView().cursor(). + docstring const layout = work_area_-bufferView().cursor(). innerParagraph().layout()-name(); if (layout != current_layout) {
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
On Monday 09 July 2007 13:55:01 Abdelrazak Younes wrote: The part below was not meant to be in the patch, please ignore: If that fixes the bug then OK. -- José Abílio
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
José Matos wrote: On Monday 09 July 2007 13:55:01 Abdelrazak Younes wrote: The part below was not meant to be in the patch, please ignore: If that fixes the bug then OK. Which one? The one that add a redundant updateToc() in LyXView or the one that updates the dialogs only if this is not LFUN_UPDATE_DIALOG in LyXFunc? Conceptually speaking, the later is more correct, even if this means a special case in LyXFunc::dispatch(). The first one will only cure the problem with the Toc, maybe other dialog has the very same problem Conclusion: I am recommending the change in LyXFunc. Abdel.
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
On Monday 09 July 2007 14:21:58 Abdelrazak Younes wrote: Which one? The one that add a redundant updateToc() in LyXView or the one that updates the dialogs only if this is not LFUN_UPDATE_DIALOG in LyXFunc? Conceptually speaking, the later is more correct, even if this means a special case in LyXFunc::dispatch(). The first one will only cure the problem with the Toc, maybe other dialog has the very same problem Then when we find the bug we fix it the same way. ;-) Conclusion: I am recommending the change in LyXFunc. I am more comfortable with the later solution (the redundant TOC). We can fix this properly for 1.6. Abdel. -- José Abílio
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
José Matos wrote: On Monday 09 July 2007 14:21:58 Abdelrazak Younes wrote: Which one? The one that add a redundant updateToc() in LyXView or the one that updates the dialogs only if this is not LFUN_UPDATE_DIALOG in LyXFunc? Conceptually speaking, the later is more correct, even if this means a special case in LyXFunc::dispatch(). The first one will only cure the problem with the Toc, maybe other dialog has the very same problem Then when we find the bug we fix it the same way. ;-) Conclusion: I am recommending the change in LyXFunc. I am more comfortable with the later solution (the redundant TOC). I don't understand why it looks any safer but anyway, I've committed it. We can fix this properly for 1.6. The proper fix would be to get rid of the restoreButton() call in Dialogs::updateBufferDependant() but I didn't dare to do it now. Abdel.
[PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
The reason is that closing a Buffer triggers an update of all opened dialogs when dispatching LFUN_DIALOG_UPDATE (hence the patch). The path is as following: setBuffer() -> updateBufferDependent() -> RestoreButton() -> LFUN The problem here is that the Toc dialog has not been reconstructed (because it comes after in the list of dialogs). This patch should definitely go _before_ 1.5.0; OK? Abdel. Index: LyXFunc.cpp === --- LyXFunc.cpp (revision 19003) +++ LyXFunc.cpp (working copy) @@ -1838,8 +1838,10 @@ } } if (!quitting) { - lyx_view_->updateMenubar(); - lyx_view_->updateToolbars(); + if (cmd.action != LFUN_DIALOG_UPDATE) { + lyx_view_->updateMenubar(); + lyx_view_->updateToolbars(); + } // Some messages may already be translated, so we cannot use _() sendDispatchMessage(translateIfPossible(getMessage()), cmd); }
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes: Abdelrazak> The problem here is that the Toc dialog has not been Abdelrazak> reconstructed (because it comes after in the list of Abdelrazak> dialogs). Abdelrazak> This patch should definitely go _before_ 1.5.0; OK? I understand that we need to fix that before 1.5.0 and that this is the easiest route, but in general I'd rather avoid to add explicit tests against LFUNS like this one. (not that I have a better solution at hand...). JMarc
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
Jean-Marc Lasgouttes wrote: "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes: Abdelrazak> The problem here is that the Toc dialog has not been Abdelrazak> reconstructed (because it comes after in the list of Abdelrazak> dialogs). Abdelrazak> This patch should definitely go _before_ 1.5.0; OK? I understand that we need to fix that before 1.5.0 and that this is the easiest route, but in general I'd rather avoid to add explicit tests against LFUNS like this one. (not that I have a better solution at hand...). I agree and I will offer a better solution after 1.5.0 is out. They are several alternatives at hand but this patch is easiest and the safest for now. Abdel.
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
Jean-Marc Lasgouttes wrote: "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes: Abdelrazak> The problem here is that the Toc dialog has not been Abdelrazak> reconstructed (because it comes after in the list of Abdelrazak> dialogs). Abdelrazak> This patch should definitely go _before_ 1.5.0; OK? I understand that we need to fix that before 1.5.0 and that this is the easiest route, but in general I'd rather avoid to add explicit tests against LFUNS like this one. (not that I have a better solution at hand...). Here is an alternative patch. I don't like it because this means that the Toc dialog will be rebuilt twice. But I'll put it in if you prefer. Longer term, we probably need to add some new properties to the LFUNs like the new clearSelection one. Abdel. Index: LyXView.cpp === --- LyXView.cpp (revision 19003) +++ LyXView.cpp (working copy) @@ -163,6 +163,18 @@ connectBuffer(*newBuffer); + /* FIXME: Rebuild the Toc dialog before the others even if it + will be rebuilt again in the next line. This avoid a crash when + other dialogs are rebuilt before the Toc dialog. The reason is + that closing a Buffer triggers an update of all opened dialogs + when dispatching LFUN_DIALOG_UPDATE (hence the patch). + The path is as following: + setBuffer() -> updateBufferDependent() -> RestoreButton() -> LFUN + + The problem here is that the Toc dialog has not been + reconstructed (because it comes after in the list of dialogs). */ + updateToc(); + // Buffer-dependent dialogs should be updated or // hidden. This should go here because some dialogs (eg ToC) // require bv_->text. @@ -462,7 +474,7 @@ } BOOST_ASSERT(work_area_); - string const & layout = work_area_->bufferView().cursor(). + docstring const & layout = work_area_->bufferView().cursor(). innerParagraph().layout()->name(); if (layout != current_layout) {
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
Abdelrazak Younes wrote: Jean-Marc Lasgouttes wrote: "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes: Abdelrazak> The problem here is that the Toc dialog has not been Abdelrazak> reconstructed (because it comes after in the list of Abdelrazak> dialogs). Abdelrazak> This patch should definitely go _before_ 1.5.0; OK? I understand that we need to fix that before 1.5.0 and that this is the easiest route, but in general I'd rather avoid to add explicit tests against LFUNS like this one. (not that I have a better solution at hand...). Here is an alternative patch. The part below was not meant to be in the patch, please ignore: @@ -462,7 +474,7 @@ } BOOST_ASSERT(work_area_); - string const & layout = work_area_->bufferView().cursor(). + docstring const & layout = work_area_->bufferView().cursor(). innerParagraph().layout()->name(); if (layout != current_layout) {
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
On Monday 09 July 2007 13:55:01 Abdelrazak Younes wrote: > The part below was not meant to be in the patch, please ignore: If that fixes the bug then OK. -- José Abílio
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
José Matos wrote: On Monday 09 July 2007 13:55:01 Abdelrazak Younes wrote: The part below was not meant to be in the patch, please ignore: If that fixes the bug then OK. Which one? The one that add a redundant updateToc() in LyXView or the one that updates the dialogs only if this is not LFUN_UPDATE_DIALOG in LyXFunc? Conceptually speaking, the later is more correct, even if this means a special case in LyXFunc::dispatch(). The first one will only cure the problem with the Toc, maybe other dialog has the very same problem Conclusion: I am recommending the change in LyXFunc. Abdel.
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
On Monday 09 July 2007 14:21:58 Abdelrazak Younes wrote: > Which one? The one that add a redundant updateToc() in LyXView or the > one that updates the dialogs only if this is not LFUN_UPDATE_DIALOG in > LyXFunc? > > Conceptually speaking, the later is more correct, even if this means a > special case in LyXFunc::dispatch(). The first one will only cure the > problem with the Toc, maybe other dialog has the very same problem Then when we find the bug we fix it the same way. ;-) > Conclusion: I am recommending the change in LyXFunc. I am more comfortable with the later solution (the redundant TOC). We can fix this properly for 1.6. > Abdel. -- José Abílio
Re: [PATCH] Fix crash when closing a child document when outline and Pref dialogs are opened
José Matos wrote: On Monday 09 July 2007 14:21:58 Abdelrazak Younes wrote: Which one? The one that add a redundant updateToc() in LyXView or the one that updates the dialogs only if this is not LFUN_UPDATE_DIALOG in LyXFunc? Conceptually speaking, the later is more correct, even if this means a special case in LyXFunc::dispatch(). The first one will only cure the problem with the Toc, maybe other dialog has the very same problem Then when we find the bug we fix it the same way. ;-) Conclusion: I am recommending the change in LyXFunc. I am more comfortable with the later solution (the redundant TOC). I don't understand why it looks any safer but anyway, I've committed it. > We can > fix this properly for 1.6. The proper fix would be to get rid of the restoreButton() call in Dialogs::updateBufferDependant() but I didn't dare to do it now. Abdel.