Skip to content

Commit

Permalink
Fix possible crash on ThreadMgr creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancheung committed Sep 9, 2020
1 parent 93de3c9 commit 12dfdec
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ImeSharp/TextServicesContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,17 @@ public ITfThreadMgrEx ThreadManager
{
if (_threadManager == null)
{
ITfThreadMgr threadMgr;
Tsf.GetThreadMgr(out threadMgr);
ITfThreadMgr threadMgr = null;
try
{
// This might fail
Tsf.GetThreadMgr(out threadMgr);
}
catch (SharpGen.Runtime.SharpGenException)
{
}

// Dispose previous ITfThreadMgr in case something weird happens
// Dispose previous ITfThreadMgr in case something weird happens
if (threadMgr != null)
{
if (threadMgr.IsThreadFocus)
Expand Down

0 comments on commit 12dfdec

Please sign in to comment.