<commit_before>#ifndef NAVIGATOR_H
#define NAVIGATOR_H

#include <memory>
#include <map>
#include <vector>
#include <stack>
#include <qvariant.h>
#include <MainWindow.h>
#include <PageStackFrame.h>
#include <PageRegistration.h>


class Navigator : public QObject
{
    Q_OBJECT
public:
    Navigator(std::unique_ptr<MainWindow> mainWindow);
    void registerPage(PageType type, std::unique_ptr<PageWidget> widget);
    void registerTransition(PageType origin, int exitCode, PageType target);
    void start(PageType type, QList<QVariant> data);

private slots:
    void tryPush(QVariant item);
    void tryRead(size_t index, QVariant& value);
    void tryExit(int exitCode);

private:
    PageRegistration* checkSender();
    void displayPage(PageType type);
    PageType getCurrentPageType() const;

    std::stack<PageStackFrame> mPageStack;
    std::vector<QVariant> mDataStack;
    std::map<PageType, PageRegistration> mPageRegistrations;
    std::unique_ptr<MainWindow> mMainWindow;


};

#endif // NAVIGATOR_H<commit_msg>Fixed segfault by rarranging Navigator's attributes.<commit_after>#ifndef NAVIGATOR_H
#define NAVIGATOR_H

#include <memory>
#include <map>
#include <vector>
#include <stack>
#include <qvariant.h>
#include <MainWindow.h>
#include <PageStackFrame.h>
#include <PageRegistration.h>


class Navigator : public QObject
{
    Q_OBJECT
public:
    Navigator(std::unique_ptr<MainWindow> mainWindow);
    void registerPage(PageType type, std::unique_ptr<PageWidget> widget);
    void registerTransition(PageType origin, int exitCode, PageType target);
    void start(PageType type, QList<QVariant> data);

private slots:
    void tryPush(QVariant item);
    void tryRead(size_t index, QVariant& value);
    void tryExit(int exitCode);

private:
    PageRegistration* checkSender();
    void displayPage(PageType type);
    PageType getCurrentPageType() const;

    std::unique_ptr<MainWindow> mMainWindow; // needs to be on top, as it takes ownership of associated objects
    std::stack<PageStackFrame> mPageStack;
    std::vector<QVariant> mDataStack;
    std::map<PageType, PageRegistration> mPageRegistrations;


};

#endif // NAVIGATOR_H
{'fraction_non_alphanumeric': 0.1050925925925926, 'fraction_numerical': 0.0, 'mean_word_length': 5.470059880239521, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '2609197', 'n_tokens_mistral': 687, 'n_tokens_neox': 672, 'n_words': 172}