<commit_before>#include "View.h"
#include <QQmlContext>
#include <QQmlProperty>
#include <QFileInfo>
#include <QQueue>
#include "Paths.h"

View::View()
    : m_model(nullptr)
{
    setFlag(ItemHasContents, true);
}

void View::componentComplete() {
    QQuickItem::componentComplete();
    auto ao = qobject_cast<ControlsAttachedType *>(qmlAttachedPropertiesObject<Controls>(this));
    connect(ao, &ControlsAttachedType::controlChangedAbs, this, &View::onControlChangedAbs);
    connect(ao, &ControlsAttachedType::controlChangedRel, this, &View::onControlChangedRel);
}

View::~View() {
}

void View::rebuild() {
    m_children.clear();
    m_selection.clear();
    onGraphChanged();
}

Child View::newChild(VideoNode *videoNode) {
    Child c;
    c.videoNode = videoNode;
    c.item = nullptr;

    auto delegate = m_delegates.value(videoNode->metaObject()->className());
    if (delegate.isEmpty()) {
        delegate = m_delegates.value("");
        if (delegate.isEmpty()) {
            qFatal("Could not find a delegate for %s", videoNode->metaObject()->className());
        }
    }
    auto qmlFileInfo = QFileInfo(Paths::qml() + QString("/%1.qml").arg(delegate));<commit_msg>fix leaky children<commit_after>#include "View.h"
#include <QQmlContext>
#include <QQmlProperty>
#include <QFileInfo>
#include <QQueue>
#include "Paths.h"

View::View()
    : m_model(nullptr)
{
    setFlag(ItemHasContents, true);
}

void View::componentComplete() {
    QQuickItem::componentComplete();
    auto ao = qobject_cast<ControlsAttachedType *>(qmlAttachedPropertiesObject<Controls>(this));
    connect(ao, &ControlsAttachedType::controlChangedAbs, this, &View::onControlChangedAbs);
    connect(ao, &ControlsAttachedType::controlChangedRel, this, &View::onControlChangedRel);
}

View::~View() {
}

void View::rebuild() {
    for (auto c = m_children.begin(); c != m_children.end(); c++) {
        c->item->deleteLater();
    }
    m_children.clear();
    m_selection.clear();
    onGraphChanged();
}

Child View::newChild(VideoNode *videoNode) {
    Child c;
    c.videoNode = videoNode;
    c.item = nullptr;

    auto delegate = m_delegates.value(videoNode->metaObject()->className());
    if (delegate.isEmpty()) {
        delegate = m_delegates.value("");
        if (delegate.isEmpty()) {
            qFatal("Could not find a delegate for %s", videoNode->metaObject()->className());
        }
    }
    auto qmlFileInfo = QFileInfo(Paths::qml() + QString("/%1.qml").arg(delegate));
{'fraction_non_alphanumeric': 0.16041918581217252, 'fraction_numerical': 0.0008061265618702137, 'mean_word_length': 4.454945054945055, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2700902', 'n_tokens_mistral': 789, 'n_tokens_neox': 789, 'n_words': 143}