Fix crash in InspectorWindow.
- In the case where retrieval of a memory block failed, InspectorWindow didn't handle the notification. Consequently, it never removed itself as a listener from the failed block, nor did it release its reference for it. Consequently, if one attempted to retrieve data from the same block again, walking the listener list would crash due to the already-deleted entry in the list. - The success case had the same problem with regards to not removing its listener, but was masked by virtue of the inspector currently being the only user of the memory block manager, so in the latter case the blocks would be properly released/destroyed and the aforementioned walk would never occur. - Adjust locking a bit to ensure that manipulating the listener list always happens with the team lock held. - Style fixes.
This commit is contained in:
@@ -1690,12 +1690,12 @@ TeamDebugger::_HandleInspectAddress(target_addr_t address,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!memoryBlock->HasListener(listener))
|
||||
memoryBlock->AddListener(listener);
|
||||
|
||||
if (!memoryBlock->IsValid()) {
|
||||
AutoLocker< ::Team> teamLocker(fTeam);
|
||||
|
||||
if (!memoryBlock->HasListener(listener))
|
||||
memoryBlock->AddListener(listener);
|
||||
|
||||
TeamMemory* memory = fTeam->GetTeamMemory();
|
||||
// schedule the job
|
||||
status_t result;
|
||||
@@ -1703,7 +1703,10 @@ TeamDebugger::_HandleInspectAddress(target_addr_t address,
|
||||
new(std::nothrow) RetrieveMemoryBlockJob(fTeam, memory,
|
||||
memoryBlock),
|
||||
this)) != B_OK) {
|
||||
|
||||
memoryBlock->NotifyDataRetrieved(result);
|
||||
memoryBlock->ReleaseReference();
|
||||
|
||||
_NotifyUser("Inspect Address", "Failed to retrieve memory data: %s",
|
||||
strerror(result));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user