MCPcopy Create free account
hub / github.com/baldurk/renderdoc / childUpdate

Method childUpdate

qrenderdoc/Windows/Dialogs/LiveCapture.cpp:439–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437}
438
439void LiveCapture::childUpdate()
440{
441 // first do a small lock and check if the list is currently empty
442 {
443 QMutexLocker l(&m_ChildrenLock);
444
445 if(m_Children.empty())
446 {
447 ui->childProcessLabel->setVisible(false);
448 ui->childProcesses->setVisible(false);
449 }
450 }
451
452 // We only compare the child processes for a local context
453 const bool local = isLocal();
454
455 // enumerate processes outside of the lock
456 QProcessList processes;
457 if(local)
458 {
459 processes = QProcessInfo::enumerate(false);
460 }
461
462 // now since we're adding and removing, we lock around the whole rest of the function. It won't be
463 // too slow.
464 {
465 QMutexLocker l(&m_ChildrenLock);
466
467 if(!m_Children.empty())
468 {
469 // remove any stale processes
470 for(int i = 0; i < m_Children.size(); i++)
471 {
472 bool found = false;
473
474 for(QProcessInfo &p : processes)
475 {
476 if(p.pid() == m_Children[i].PID)
477 {
478 found = true;
479 break;
480 }
481 }
482
483 if(!found && local)
484 {
485 if(m_Children[i].added)
486 {
487 for(int c = 0; c < ui->childProcesses->count(); c++)
488 {
489 QListWidgetItem *item = ui->childProcesses->item(c);
490 if(item->data(PIDRole).toUInt() == m_Children[i].PID)
491 delete ui->childProcesses->takeItem(c);
492 }
493 }
494
495 // process expired/doesn't exist anymore
496 m_Children.removeAt(i);

Callers

nothing calls this directly

Calls 13

itemMethod · 0.80
trFunction · 0.50
QVariantClass · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
pidMethod · 0.45
countMethod · 0.45
dataMethod · 0.45
removeAtMethod · 0.45
nameMethod · 0.45
argMethod · 0.45
setDataMethod · 0.45

Tested by

no test coverage detected