From 869f7834e8ddfc389f2c3eed99a2b5f8a1b88751 Mon Sep 17 00:00:00 2001 From: bclothier Date: Mon, 12 Nov 2018 22:21:40 -0600 Subject: [PATCH] Address PR comments --- .../CommandBars/AppCommandBarBase.cs | 2 + .../ParentMenus/ParentMenuItemBase.cs | 2 + .../Rubberduck.Resources.csproj | 144 ++++++++++++++++++ Rubberduck.VBEEditor/Events/VbeEvents.cs | 1 - .../SafeComWrappers/VB/CodePane.cs | 2 +- .../SafeComWrappers/VB/VBProjects.cs | 6 +- .../SafeComWrappers/VB/CodePane.cs | 2 +- .../SafeComWrappers/VB/VBProjects.cs | 6 +- 8 files changed, 156 insertions(+), 9 deletions(-) diff --git a/Rubberduck.Core/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs b/Rubberduck.Core/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs index 8c1c76f8bb..ff67c2ff84 100644 --- a/Rubberduck.Core/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs +++ b/Rubberduck.Core/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs @@ -200,6 +200,8 @@ public void RemoveCommandBar() Logger.Debug("Removing commandbar."); RemoveChildren(); Item.Delete(); + + // Setting them to null will automatically dispose those Item = null; Parent = null; } diff --git a/Rubberduck.Core/UI/Command/MenuItems/ParentMenus/ParentMenuItemBase.cs b/Rubberduck.Core/UI/Command/MenuItems/ParentMenus/ParentMenuItemBase.cs index 71df1c8b6f..713a256f24 100644 --- a/Rubberduck.Core/UI/Command/MenuItems/ParentMenus/ParentMenuItemBase.cs +++ b/Rubberduck.Core/UI/Command/MenuItems/ParentMenus/ParentMenuItemBase.cs @@ -110,6 +110,8 @@ public void RemoveMenu() Logger.Debug($"Removing menu {_key}."); RemoveChildren(); Item?.Delete(); + + //This will also dispose the Item as well Item = null; } diff --git a/Rubberduck.Resources/Rubberduck.Resources.csproj b/Rubberduck.Resources/Rubberduck.Resources.csproj index bfee94b500..c13d96be02 100644 --- a/Rubberduck.Resources/Rubberduck.Resources.csproj +++ b/Rubberduck.Resources/Rubberduck.Resources.csproj @@ -30,26 +30,170 @@ + + True + True + AboutUI.resx + + + True + True + CodeExplorerUI.resx + + + True + True + CommandBarIcons.resx + + + True + True + InspectionInfo.resx + + + True + True + InspectionNames.resx + + + True + True + InspectionResults.resx + + + True + True + InspectionsUI.resx + + + True + True + QuickFixes.resx + + + True + True + RubberduckMenus.resx + + + True + True + RegexAssistantUI.resx + True True RubberduckUI.resx + + True + True + AutoCompletesPage.resx + True True SettingsUI.resx + + True + True + ToDoExplorerPage.resx + + + True + True + UnitTestingPage.resx + + + True + True + ToDoExplorerUI.resx + + + True + True + AssertMessages.resx + + + True + True + TestExplorer.resx + + + PublicResXFileCodeGenerator + AboutUI.Designer.cs + + + PublicResXFileCodeGenerator + CodeExplorerUI.Designer.cs + + + PublicResXFileCodeGenerator + CommandBarIcons.Designer.cs + + + PublicResXFileCodeGenerator + InspectionInfo.Designer.cs + + + PublicResXFileCodeGenerator + InspectionNames.Designer.cs + + + PublicResXFileCodeGenerator + InspectionResults.Designer.cs + + + PublicResXFileCodeGenerator + InspectionsUI.Designer.cs + + + PublicResXFileCodeGenerator + QuickFixes.Designer.cs + + + PublicResXFileCodeGenerator + RubberduckMenus.Designer.cs + + + PublicResXFileCodeGenerator + RegexAssistantUI.Designer.cs + PublicResXFileCodeGenerator RubberduckUI.Designer.cs + + PublicResXFileCodeGenerator + AutoCompletesPage.Designer.cs + PublicResXFileCodeGenerator SettingsUI.Designer.cs + + PublicResXFileCodeGenerator + ToDoExplorerPage.Designer.cs + + + PublicResXFileCodeGenerator + UnitTestingPage.Designer.cs + + + PublicResXFileCodeGenerator + ToDoExplorerUI.Designer.cs + + + PublicResXFileCodeGenerator + AssertMessages.Designer.cs + + + PublicResXFileCodeGenerator + TestExplorer.Designer.cs + \ No newline at end of file diff --git a/Rubberduck.VBEEditor/Events/VbeEvents.cs b/Rubberduck.VBEEditor/Events/VbeEvents.cs index a2228cc266..213cae5f5a 100644 --- a/Rubberduck.VBEEditor/Events/VbeEvents.cs +++ b/Rubberduck.VBEEditor/Events/VbeEvents.cs @@ -73,7 +73,6 @@ private void RegisterComponents(string projectId, string projectName) if (item.ProjectId == projectId && item.Name == projectName) { project = item; - item.Dispose(); break; } diff --git a/Rubberduck.VBEditor.VB6/SafeComWrappers/VB/CodePane.cs b/Rubberduck.VBEditor.VB6/SafeComWrappers/VB/CodePane.cs index 8dd908f1cb..387f58e1ea 100644 --- a/Rubberduck.VBEditor.VB6/SafeComWrappers/VB/CodePane.cs +++ b/Rubberduck.VBEditor.VB6/SafeComWrappers/VB/CodePane.cs @@ -115,7 +115,7 @@ private void ForceFocus() } else { - System.Diagnostics.Debug.WriteLine( + _logger.Debug( "CodePane.ForceFocus() failed to get a handle on the MainWindow."); } } diff --git a/Rubberduck.VBEditor.VB6/SafeComWrappers/VB/VBProjects.cs b/Rubberduck.VBEditor.VB6/SafeComWrappers/VB/VBProjects.cs index aa66090d0d..3a4355e4d5 100644 --- a/Rubberduck.VBEditor.VB6/SafeComWrappers/VB/VBProjects.cs +++ b/Rubberduck.VBEditor.VB6/SafeComWrappers/VB/VBProjects.cs @@ -101,13 +101,13 @@ void VB._dispVBProjectsEvents.ItemRenamed([MarshalAs(UnmanagedType.Interface), I var projectId = project.ProjectId; - var handler = ProjectRenamed; - if (handler == null || projectId == null) + if (projectId == null) { return; } - handler.Invoke(this, new ProjectRenamedEventArgs(projectId, project.Name, OldName)); + var handler = ProjectRenamed; + handler?.Invoke(this, new ProjectRenamedEventArgs(projectId, project.Name, OldName)); } } diff --git a/Rubberduck.VBEditor.VBA/SafeComWrappers/VB/CodePane.cs b/Rubberduck.VBEditor.VBA/SafeComWrappers/VB/CodePane.cs index 1ac19c732e..99498a89a7 100644 --- a/Rubberduck.VBEditor.VBA/SafeComWrappers/VB/CodePane.cs +++ b/Rubberduck.VBEditor.VBA/SafeComWrappers/VB/CodePane.cs @@ -115,7 +115,7 @@ private void ForceFocus() } else { - System.Diagnostics.Debug.WriteLine( + _logger.Debug( "CodePane.ForceFocus() failed to get a handle on the MainWindow."); } } diff --git a/Rubberduck.VBEditor.VBA/SafeComWrappers/VB/VBProjects.cs b/Rubberduck.VBEditor.VBA/SafeComWrappers/VB/VBProjects.cs index ed554448ee..8fd7c9ada1 100644 --- a/Rubberduck.VBEditor.VBA/SafeComWrappers/VB/VBProjects.cs +++ b/Rubberduck.VBEditor.VBA/SafeComWrappers/VB/VBProjects.cs @@ -105,13 +105,13 @@ void VB._dispVBProjectsEvents.ItemRenamed([MarshalAs(UnmanagedType.Interface), I var projectId = project.ProjectId; - var handler = ProjectRenamed; - if (handler == null || projectId == null) + if (projectId == null) { return; } - handler.Invoke(this, new ProjectRenamedEventArgs(projectId, project.Name, OldName)); + var handler = ProjectRenamed; + handler?.Invoke(this, new ProjectRenamedEventArgs(projectId, project.Name, OldName)); } }