Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07c3f37

Browse files
dungpaKevinRansom
authored andcommitted
Dispose FSharpProjectPackage properly (dotnet#2058)
* Dispose FSharpProjectPackage properly* Ensure that revoking component is thread-safe
1 parent0e6614e commit07c3f37

File tree

1 file changed

+12
-4
lines changed
  • vsintegration/src/FSharp.ProjectSystem.FSharp

1 file changed

+12
-4
lines changed

‎vsintegration/src/FSharp.ProjectSystem.FSharp/Project.fs‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
193193
let mutablemgr:IOleComponentManager=null
194194
let mutablecomponentID=0u
195195

196+
letlocker= obj()
197+
196198
memberthis.RegisterForIdleTime()=
197199
mgr<- this.GetService(typeof<SOleComponentManager>):?> IOleComponentManager
198200
if componentID=0u&&not(isNull mgr)then
@@ -203,10 +205,7 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
203205
crinfo0.grfcadvf<- uint32(_OLECADVF.olecadvfModal|||_OLECADVF.olecadvfRedrawOff|||_OLECADVF.olecadvfWarningsOff)
204206
crinfo0.uIdleTimeInterval<-1000u
205207
crinfo.[0]<- crinfo0
206-
letcomponentID_out= ref componentID
207-
let_hr= mgr.FRegisterComponent(this, crinfo, componentID_out)
208-
componentID<- componentID_out.Value
209-
()
208+
mgr.FRegisterComponent(this, crinfo,&componentID)|> ignore
210209

211210
/// This method loads a localized string based on the specified resource.
212211
@@ -355,6 +354,15 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
355354
pIdIco<-400u
356355
VSConstants.S_OK
357356

357+
overridethis.Dispose(disposing)=
358+
try
359+
lock(locker)(fun _->
360+
if componentID<>0u&&not(isNull mgr)then
361+
mgr.FRevokeComponent(componentID)|> ignore
362+
componentID<-0u)
363+
finally
364+
base.Dispose(disposing)
365+
358366
interface Microsoft.VisualStudio.FSharp.Interactive.ITestVFSIwith
359367
memberthis.SendTextInteraction(s:string)=
360368
GetToolWindowAsITestVFSI().SendTextInteraction(s)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp