File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ public class InfoBar : IVsInfoBarUIEvents
9494 private readonly IVsInfoBarHost _host ;
9595 private readonly InfoBarModel _model ;
9696 private IVsInfoBarUIElement ? _uiElement ;
97+ private uint _listenerCookie ;
9798
9899 /// <summary>
99100 /// Creates a new instance of the InfoBar in a specific window frame or document window.
@@ -119,7 +120,7 @@ public async Task<bool> TryShowInfoBarUIAsync()
119120 IVsInfoBarUIFactory infoBarUIFactory = ( IVsInfoBarUIFactory ) await VS . GetRequiredServiceAsync < SVsInfoBarUIFactory , object > ( ) ;
120121
121122 _uiElement = infoBarUIFactory . CreateInfoBar ( _model ) ;
122- _uiElement . Advise ( this , out _ ) ;
123+ _uiElement . Advise ( this , out _listenerCookie ) ;
123124
124125 if ( _host != null )
125126 {
@@ -171,6 +172,7 @@ public void Close()
171172 void IVsInfoBarUIEvents . OnClosed ( IVsInfoBarUIElement infoBarUIElement )
172173 {
173174 IsVisible = false ;
175+ _uiElement ? . Unadvise ( _listenerCookie ) ;
174176 }
175177
176178 void IVsInfoBarUIEvents . OnActionItemClicked ( IVsInfoBarUIElement infoBarUIElement , IVsInfoBarActionItem actionItem )
You can’t perform that action at this time.
0 commit comments