trying to connect gui with the algorithm. have segfault on exit(gui part)