Revision | 23123 (tree) |
---|---|
Zeit | 2012-08-03 03:44:40 |
Autor | stefankueng |
In case creating the client context fails, check for the invalid context and in case it's invalid, make sure the path gets crawled again.
(Fixes issue #383) : access violation if context creation fails
@@ -108,6 +108,8 @@ | ||
108 | 108 | log cache. (Stefan Fuhrmann) |
109 | 109 | - BUG: Issue #382: Don't crash in log cache when path |
110 | 110 | info is not available. (Stefan Fuhrmann) |
111 | +- BUG: Issue #383: access violation if context | |
112 | + creation fails. (Stefan) | |
111 | 113 | |
112 | 114 | Version 1.7.7 |
113 | 115 | - BUG: Issue #233: Crash when closing the |
@@ -1,6 +1,6 @@ | ||
1 | 1 | // TortoiseSVN - a Windows shell extension for easy version control |
2 | 2 | |
3 | -// Copyright (C) 2003-2011 - TortoiseSVN | |
3 | +// Copyright (C) 2003-2012 - TortoiseSVN | |
4 | 4 | |
5 | 5 | // This program is free software; you can redistribute it and/or |
6 | 6 | // modify it under the terms of the GNU General Public License |
@@ -78,11 +78,14 @@ | ||
78 | 78 | if (pool == NULL) |
79 | 79 | return m_ctx; |
80 | 80 | |
81 | - svn_client_ctx_t * ctx; | |
81 | + svn_client_ctx_t * ctx = nullptr; | |
82 | 82 | svn_error_clear(svn_client_create_context(&ctx, pool)); |
83 | - ctx->cancel_func = cancelfunc; | |
84 | - ctx->cancel_baton = (void *)this; | |
85 | - ctx->config = m_config; | |
83 | + if (ctx) | |
84 | + { | |
85 | + ctx->cancel_func = cancelfunc; | |
86 | + ctx->cancel_baton = (void *)this; | |
87 | + ctx->config = m_config; | |
88 | + } | |
86 | 89 | |
87 | 90 | return ctx; |
88 | 91 | } |
@@ -513,28 +513,41 @@ | ||
513 | 513 | return false; |
514 | 514 | } |
515 | 515 | m_pCtx = CSVNStatusCache::Instance().m_svnHelp.ClientContext(subPool); |
516 | - svn_error_t* pErr = svn_client_status5 ( | |
517 | - NULL, | |
518 | - m_pCtx, | |
519 | - svnapipath, | |
520 | - &revision, | |
521 | - svn_depth_immediates, | |
522 | - TRUE, // get all | |
523 | - FALSE, // update | |
524 | - TRUE, // no ignores | |
525 | - FALSE, // ignore externals | |
526 | - TRUE, // depth as sticky | |
527 | - NULL, // changelists | |
528 | - GetStatusCallback, | |
529 | - this, | |
530 | - subPool | |
531 | - ); | |
516 | + svn_error_t * pErr = nullptr; | |
517 | + if (m_pCtx) | |
518 | + { | |
519 | + pErr = svn_client_status5 ( | |
520 | + NULL, | |
521 | + m_pCtx, | |
522 | + svnapipath, | |
523 | + &revision, | |
524 | + svn_depth_immediates, | |
525 | + TRUE, // get all | |
526 | + FALSE, // update | |
527 | + TRUE, // no ignores | |
528 | + FALSE, // ignore externals | |
529 | + TRUE, // depth as sticky | |
530 | + NULL, // changelists | |
531 | + GetStatusCallback, | |
532 | + this, | |
533 | + subPool | |
534 | + ); | |
532 | 535 | |
533 | - svn_wc_context_destroy(m_pCtx->wc_ctx); | |
534 | - m_pCtx->wc_ctx = NULL; | |
535 | - m_pCtx = NULL; | |
536 | + svn_wc_context_destroy(m_pCtx->wc_ctx); | |
537 | + m_pCtx->wc_ctx = NULL; | |
538 | + m_pCtx = NULL; | |
539 | + } | |
540 | + else | |
541 | + { | |
542 | + CTraceToOutputDebugString::Instance()(__FUNCTION__ ": error creating client context!\n"); | |
543 | + m_currentFullStatus = m_mostImportantFileStatus = svn_wc_status_none; | |
544 | + // Since we only assume a none status here due to the fact that we couldn't get a client context, | |
545 | + // make sure that this status times out soon. | |
546 | + CSVNStatusCache::Instance().m_folderCrawler.BlockPath(m_directoryPath, 20); | |
547 | + CSVNStatusCache::Instance().AddFolderForCrawling(m_directoryPath); | |
548 | + } | |
536 | 549 | InterlockedExchange(&m_FetchingStatus, FALSE); |
537 | - if(pErr) | |
550 | + if (pErr) | |
538 | 551 | { |
539 | 552 | // Handle an error |
540 | 553 | // The most likely error on a folder is that it's not part of a WC |