I have the class X. I want to destruct it when user click [_] [x]-here (close window button). What should I do? I need it, because I mmap something in class X and I need to munmap it while exit.
Example:
X *myclass;
int main(int argc, char** argv) {
myclass = new X();
//…
// Some glut stuff…
//…
glutMainLoop();
return 1;
}
How to delete myclass or destruct it (myclass->~X) while exit? Where?
P.S.
I use GLUT thread and create new window with GLUT too. TNX!