X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/2d7fff39ec5ab67f13b5250a60082c4bc62c1739..212f9ae5dc8899bab8b23ed13d81c28c510db3c3:/Client/src/principal.cpp diff --git a/Client/src/principal.cpp b/Client/src/principal.cpp index 0b59c0b..1b42b2b 100644 --- a/Client/src/principal.cpp +++ b/Client/src/principal.cpp @@ -62,8 +62,13 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr & Principal::~Principal() { - if (conexion != NULL) - delete conexion; + if (conexion) { + conexion->finish(); + } + // Espera a que termine realmente. + while (conexion) { + Glib::usleep(10000); // 10 milisegundos + } } void Principal::on_dlg_connect_ok() @@ -75,8 +80,9 @@ void Principal::on_dlg_connect_ok() } catch (...) { txt_view->get_buffer()->insert_at_cursor("NO SE PUDO CREAR OBJETO\n"); - delete conexion; - conexion == NULL; + //delete conexion; XXX Si no me equivoco, si falla el + //constructor, no se reserva la memoria (el delete no va). + conexion = NULL; return; } @@ -122,7 +128,7 @@ void Principal::on_mnu_file_disconnect() PlaQui::Server::Command c("connection", "stop"); c.add_arg(conexion->get_host()); - c.add_arg("7522"); + c.add_arg(conexion->get_port()); conexion->send(c); }