Okay, so I've been trying to find a solution around this error all day with no Luck. So, I'm working on a project that has a login screen that is loaded from a Form file but when I do login and the program tries to load another Form file the program crashes and opens the xtree file with the error "Unhandled exception thrown: read access violation." and "**_Scary** was 0xEA8.".The thing is that everything worked fine yesterday and I commited my work to my repo and some of my teammates ran the code and it worked fine....
Note: I tried everything on the forum and search online with no luck.
FormManger.h
FormManger.cpp
Thanks in advance for the help.
Note: I tried everything on the forum and search online with no luck.
FormManger.h
Code Select
#include <SFML/Graphics.hpp>
#include <TGUI/TGUI.hpp>
#include <iostream>
#pragma once
#define STUDENT_FORM_PATH "resources/StudenetForm.txt"
#define INSTRUCTOR_FORM_PATH "resources/InstructorFrm.txt"
#define LOGIN_FORM_PATH "resources/LoginScrnForm.txt"
class FormManger
{
private:
public:
struct
{
tgui::String Student = STUDENT_FORM_PATH;
tgui::String Login = LOGIN_FORM_PATH;
tgui::String Instructor = INSTRUCTOR_FORM_PATH;
}Form;
void Setscreen(sf::RenderWindow& win, tgui::GuiSFML& gui, tgui::String User, tgui::String Usertype);
};
FormManger.cpp
Code Select
#include "FormManger.h"
void FormManger::Setscreen(sf::RenderWindow &win,tgui::GuiSFML &gui ,tgui::String User, tgui::String Usertype)
{
try {
if (Usertype == "IN")
{
gui.removeAllWidgets();
std::cout << "\nLogged in as Instructor\n";
gui.loadWidgetsFromFile(Form.Instructor);
}
else if(Usertype == "ST")
{
gui.removeAllWidgets();
std::cout << "\nLogged in as Student\n";
gui.loadWidgetsFromFile(Form.Student, true);
gui.get<tgui::Button>("USR_Button")->setText(User);
}
}
catch(const tgui::Exception &e)
{
std::cout << "Error occoured: " << e.what() << std::endl;
}
}
Thanks in advance for the help.