diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2019-09-18 16:24:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-18 16:24:58 +0300 |
commit | 610d6669a4abc91eb2d2eedc6d4b81353aa835d4 (patch) | |
tree | a4fd82201baa5432fd14cc37961565d14cfe0790 /main | |
parent | 84e8be52bdced94ae856ca64e8ab1d7f977203e4 (diff) | |
parent | ea057fea83047381e8ff1cc9ad9fe6102da92b08 (diff) |
Merge pull request #8760 from mono/fix-983862
Fix attachment view display issue
Diffstat (limited to 'main')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs | 13 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/GtkShellDocumentViewItem.cs | 11 |
2 files changed, 20 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs index 935b6c5581..ff3a0204cf 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs @@ -379,11 +379,22 @@ namespace MonoDevelop.Ide.Gui.Documents attachmentsContainer = window.CreateViewContainer (); attachmentsContainer.SetSupportedModes (DocumentViewContainerMode.Tabs); attachmentsContainer.CurrentMode = DocumentViewContainerMode.Tabs; + + bool mainViewVisible = shellView == mainShellView; + shellView = attachmentsContainer; + + if (mainViewVisible) { + // If the shell view is already set it is likely it has already been added to a container + // In that case we need the attachemnts container to replace it, so that the view can + // be added to the attachments container + ReplaceViewInParent (); + } + attachmentsContainer.InsertView (0, mainShellView); + int pos = 1; foreach (var attachedView in AttachedViews) attachmentsContainer.InsertView (pos++, attachedView.CreateShellView (window)); - shellView = attachmentsContainer; } private void InitializeAttachmentsContainer () diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/GtkShellDocumentViewItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/GtkShellDocumentViewItem.cs index 47264af344..1ce39e3b49 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/GtkShellDocumentViewItem.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/GtkShellDocumentViewItem.cs @@ -44,6 +44,7 @@ namespace MonoDevelop.Ide.Gui.Shell object delegatedCommandTarget; Task loadTask; bool subscribedWindowsEvents; + bool destroyed; public GtkShellDocumentViewItem () { @@ -78,13 +79,16 @@ namespace MonoDevelop.Ide.Gui.Shell Application.Invoke ((s,a) => { // Don't execute Load inside the OnRealized handler, since Load can trigger events or async continuations that // can end having an effect on the current widget, and that may cause weird behaviors of GTK. - Load ().Ignore (); - SubscribeWindowEvents (); + if (!destroyed) { + Load ().Ignore (); + SubscribeWindowEvents (); + } }); } protected override void OnDestroyed () { + destroyed = true; cancellationTokenSource.Cancel (); focusLostTimeout?.Dispose (); @@ -179,7 +183,8 @@ namespace MonoDevelop.Ide.Gui.Shell if (focusLostTimeout == null) { focusLostTimeout = Xwt.Application.TimeoutInvoke (100, () => { - NotifyLostFocus (); + if (!destroyed) + NotifyLostFocus (); return false; }); } |