Fix double free
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 3m43s

This commit is contained in:
2024-12-17 11:58:20 -05:00
parent 780fd8308a
commit 921f2118e8
4 changed files with 17 additions and 12 deletions

View File

@@ -322,7 +322,7 @@ public:
bool wResizable = true,
bool wVsync = false) :
RWindowImpl(wTitle, wWidth, wHeight, wRenderer, wFullscreen, wResizable, wVsync) {};
~RWindow();
~RWindow() = default;
public:
// Platform dependant
void Open() { RWindowImpl::Open(); };

View File

@@ -26,9 +26,9 @@ class MyWindow : public ReWindow::RWindow {
void OnKeyDown(const ReWindow::KeyDownEvent& e) override {}
void OnRefresh(float elapsed) override {
//glClearColor(255, 0, 0, 255);
//glClear(GL_COLOR_BUFFER_BIT);
//GLSwapBuffers();
glClearColor(255, 0, 0, 255);
glClear(GL_COLOR_BUFFER_BIT);
GLSwapBuffers();
auto pos = GetMouseCoordinates();
//std::cout << pos.x << ", " << pos.y << std::endl;
@@ -105,7 +105,7 @@ int main() {
}
*/
auto* window = new MyWindow("Test Window", 600, 480);
MyWindow* window = new MyWindow("Test Window", 600, 480);
jlog::Debug(std::format("New window '{}' created. width={} height={}", window->GetTitle(), window->GetWidth(),
window->GetHeight()));
@@ -148,10 +148,11 @@ int main() {
std::cout << window->GetMouseWheelPersistent() << std::endl;
};
/*
while (!window->IsClosing()) {
//window->PollEvents();
window->ManagedRefresh();
}
}*/
// Found problem
// free(): double free detected in tcache 2
@@ -173,16 +174,20 @@ int main() {
//exit(0);
auto* windowdos = new MyWindow("Test Window Dos", 600, 480);
MyWindow* windowdos = new MyWindow("Test Window Dos", 600, 480);
windowdos->SetRenderer(ReWindow::RenderingAPI::OPENGL);
windowdos->Open();
/*
while (!windowdos->IsClosing()) {
//window->PollEvents();
window->ManagedRefresh();
windowdos->ManagedRefresh();
}
*/
delete window;
delete windowdos;
return 0;
}

View File

@@ -166,7 +166,7 @@ void RWindowImpl::PollEvents() {
if (pPlatform->xev.type == ClientMessage)
Logger::Info(std::format("Event '{}'", "ClientMessage"));
// Hmm
// Hmmm
/*
if (pPlatform->xev.xclient.message_type == XInternAtom(pPlatform->display, "WM_PROTOCOLS", False) && static_cast<Atom>(pPlatform->xev.xclient.data.l[0]) == pPlatform->wmDeleteWindow) {
Close();

View File

@@ -42,13 +42,13 @@ flags{false,wFullscreen,wResizable,wVsync} {
*/
RWindow::~RWindow() {
//RWindow::~RWindow() {
/*
if (open)
DestroyOSWindowHandle();
*/
RWindowImpl::~RWindowImpl();
}
//RWindowImpl::~RWindowImpl();
//}