2012-12-02 49 views
1

我的应用程序与下面的未处理的异常崩溃:SharpSvn SvnClient.GetLog引发AccessViolationException

System.AccessViolationException was unhandled 
    HResult=-2147467261 
    Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 
    Source=SharpSvn 
    StackTrace: 
     at apr_pool_destroy(apr_pool_t*) 
     at SharpSvn.Implementation.AprPool.Destroy() 
     at SharpSvn.Implementation.AprPool.Dispose(Boolean) 
     at SharpSvn.Implementation.AprPool.Dispose() 
     at SharpSvn.SvnClient.InternalLog(ICollection`1 targets, Uri logRoot, SvnRevision altPegRev, SvnLogArgs args, EventHandler`1 logHandler) 
     at SharpSvn.SvnClient.Log(Uri target, SvnLogArgs args, EventHandler`1 logHandler) 
     at SharpSvn.SvnClient.GetLog(Uri target, SvnLogArgs args, Collection`1& logItems) 
     at SourceLog.Plugin.Subversion.SubversionPlugin.CheckForNewLogEntries(Object state) 
     at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state) 
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.TimerQueueTimer.CallCallback() 
     at System.Threading.TimerQueueTimer.Fire() 
     at System.Threading.TimerQueue.FireQueuedTimerCompletion(Object state) 
     at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 
     at System.Threading.ThreadPoolWorkQueue.Dispatch() 
     at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() 
    InnerException: 

到SharpSvn.SvnClient.GetLog的通话是在这里:https://github.com/tomhunter-gh/SourceLog/blob/2fa0632665550c18c9cd23500610704e3eaa35a2/SourceLog.Plugin.Subversion/SubversionPlugin.cs#L39

回答

1

看起来这是由于多个计时器同时调用GetLog的回调实例和方法(SharpSvn一般?)不是线程安全的。我添加了一个静态锁定对象,以确保一次只有一个线程调用GetLog。

相关问题