<commit_before>#include "ResourceManager.hpp"

#include "../Shader/Shader.hpp"
#include "../Shader/ShaderProgram.hpp"
#include "../Geometry/Rectangle.hpp"
#include "../Geometry/Cube.hpp"
#include "../Texture/Texture2D.hpp"
#include "../Font/Font.hpp"

using namespace std;

ResourceManager::ResourceManager() {
    rectangleCount = 0;
}

Shader* ResourceManager::CreateShader(const char* source, int sourceLength, GLenum shaderType) {
    if (shaders.find(source) == shaders.end()) {
        shaders[source].shader = new Shader(source, sourceLength, shaderType);
        shadersInverse[shaders[source].shader] = source;
        shaders[source].count = 1;
    } else {
        shaders[source].count++;
    }
    
    return shaders[source].shader;
}

void ResourceManager::FreeShader(Shader* shader) {
    const char* source = shadersInverse[shader];
    
    shaders[source].count--;
    if (shaders[source].count <= 0) {<commit_msg>Fix uninitialized cube count.<commit_after>#include "ResourceManager.hpp"

#include "../Shader/Shader.hpp"
#include "../Shader/ShaderProgram.hpp"
#include "../Geometry/Rectangle.hpp"
#include "../Geometry/Cube.hpp"
#include "../Texture/Texture2D.hpp"
#include "../Font/Font.hpp"

using namespace std;

ResourceManager::ResourceManager() {
    rectangleCount = 0;
    cubeCount = 0;
}

Shader* ResourceManager::CreateShader(const char* source, int sourceLength, GLenum shaderType) {
    if (shaders.find(source) == shaders.end()) {
        shaders[source].shader = new Shader(source, sourceLength, shaderType);
        shadersInverse[shaders[source].shader] = source;
        shaders[source].count = 1;
    } else {
        shaders[source].count++;
    }
    
    return shaders[source].shader;
}

void ResourceManager::FreeShader(Shader* shader) {
    const char* source = shadersInverse[shader];
    
    shaders[source].count--;
    if (shaders[source].count <= 0) {
{'fraction_non_alphanumeric': 0.15307732772225144, 'fraction_numerical': 0.004734350341925302, 'mean_word_length': 3.803030303030303, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4808874', 'n_tokens_mistral': 591, 'n_tokens_neox': 587, 'n_words': 115}