CdbExtension: Make sure watches group is initialized.

This fixes a crash that occurs when a debugger was started
without an active watch and a watch were added afterwards.

Change-Id: I0219a750bae7b433240b22f99b2e8fd8655ca331
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
David Schulz
2015-12-04 14:36:04 +01:00
parent 2714a7e981
commit ea8665c2e2

View File

@@ -513,14 +513,16 @@ static std::string commandLocals(ExtensionCommandContext &commandExtCtx,PCSTR ar
if (watchSynchronization) { if (watchSynchronization) {
watchesSymbolGroup = 0; watchesSymbolGroup = 0;
extCtx.discardWatchesSymbolGroup(); extCtx.discardWatchesSymbolGroup();
if (!watcherInameExpressionMap.empty()) { }
// Force group into existence
watchesSymbolGroup = extCtx.watchesSymbolGroup(commandExtCtx.symbols(), errorMessage); if (watchesSymbolGroup == 0
if (!watchesSymbolGroup || !watchesSymbolGroup->synchronize(commandExtCtx.symbols(), && (!watcherInameExpressionMap.empty() || WatchesSymbolGroup::isWatchIname(iname))) {
watcherInameExpressionMap, // Force group into existence
errorMessage)) { watchesSymbolGroup = extCtx.watchesSymbolGroup(commandExtCtx.symbols(), errorMessage);
return std::string(); if (!watchesSymbolGroup || !watchesSymbolGroup->synchronize(commandExtCtx.symbols(),
} watcherInameExpressionMap,
errorMessage)) {
return std::string();
} }
} }