Commit 4a6257e06c8c55a7429ac56cbe26b71af0e78abc
1 parent
941b5a97
Exists in
master
and in
1 other branch
Fixing object cleanup on windows version.
Showing
4 changed files
with
61 additions
and
7 deletions
Show diff stats
pw3270-plugin-ipc.cbp
| @@ -99,6 +99,9 @@ | @@ -99,6 +99,9 @@ | ||
| 99 | <Unit filename="src/core/windows/start.c"> | 99 | <Unit filename="src/core/windows/start.c"> |
| 100 | <Option compilerVar="CC" /> | 100 | <Option compilerVar="CC" /> |
| 101 | </Unit> | 101 | </Unit> |
| 102 | + <Unit filename="src/core/windows/stop.c"> | ||
| 103 | + <Option compilerVar="CC" /> | ||
| 104 | + </Unit> | ||
| 102 | <Unit filename="src/include/config.h" /> | 105 | <Unit filename="src/include/config.h" /> |
| 103 | <Unit filename="src/include/config.h.in" /> | 106 | <Unit filename="src/include/config.h.in" /> |
| 104 | <Unit filename="src/include/lib3270/ipc.h" /> | 107 | <Unit filename="src/include/lib3270/ipc.h" /> |
src/core/windows/gobject.c
| @@ -43,13 +43,7 @@ static void ipc3270_finalize(GObject *object) { | @@ -43,13 +43,7 @@ static void ipc3270_finalize(GObject *object) { | ||
| 43 | 43 | ||
| 44 | debug("ipc3270::%s(%p)",__FUNCTION__,object); | 44 | debug("ipc3270::%s(%p)",__FUNCTION__,object); |
| 45 | 45 | ||
| 46 | - ipc3270 * ipc = IPC3270(object); | ||
| 47 | - | ||
| 48 | - if(ipc->source) | ||
| 49 | - { | ||
| 50 | - g_source_destroy((GSource *) ipc->source); | ||
| 51 | - ipc->source = NULL; | ||
| 52 | - } | 46 | + ipc3270_release_object(IPC3270(object)); |
| 53 | 47 | ||
| 54 | G_OBJECT_CLASS(ipc3270_parent_class)->finalize(object); | 48 | G_OBJECT_CLASS(ipc3270_parent_class)->finalize(object); |
| 55 | 49 |
src/core/windows/gobject.h
| @@ -90,6 +90,7 @@ | @@ -90,6 +90,7 @@ | ||
| 90 | 90 | ||
| 91 | G_GNUC_INTERNAL GSourceFuncs ipc3270_source_funcs; | 91 | G_GNUC_INTERNAL GSourceFuncs ipc3270_source_funcs; |
| 92 | 92 | ||
| 93 | + G_GNUC_INTERNAL void ipc3270_release_object(ipc3270 *object); | ||
| 93 | G_GNUC_INTERNAL void ipc3270_wait_for_client(IPC3270_PIPE_SOURCE *source); | 94 | G_GNUC_INTERNAL void ipc3270_wait_for_client(IPC3270_PIPE_SOURCE *source); |
| 94 | 95 | ||
| 95 | G_END_DECLS | 96 | G_END_DECLS |
| @@ -0,0 +1,56 @@ | @@ -0,0 +1,56 @@ | ||
| 1 | +/* | ||
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
| 5 | + * | ||
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
| 7 | + * | ||
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
| 10 | + * Free Software Foundation. | ||
| 11 | + * | ||
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
| 15 | + * obter mais detalhes. | ||
| 16 | + * | ||
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | + * | ||
| 21 | + * Este programa está nomeado como main.c e possui - linhas de código. | ||
| 22 | + * | ||
| 23 | + * Referências: | ||
| 24 | + * | ||
| 25 | + * https://github.com/joprietoe/gdbus/blob/master/gdbus-example-server.c | ||
| 26 | + * https://github.com/bratsche/glib/blob/master/gio/tests/gdbus-example-export.c | ||
| 27 | + * | ||
| 28 | + * Contatos: | ||
| 29 | + * | ||
| 30 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
| 31 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
| 32 | + * | ||
| 33 | + */ | ||
| 34 | + | ||
| 35 | +#include "gobject.h" | ||
| 36 | +#include <lib3270.h> | ||
| 37 | +#include <lib3270/ipc.h> | ||
| 38 | + | ||
| 39 | +#include <dbus/dbus-glib.h> | ||
| 40 | +#include <dbus/dbus-glib-bindings.h> | ||
| 41 | + | ||
| 42 | +void ipc3270_release_object(ipc3270 *object) { | ||
| 43 | + | ||
| 44 | + if(object->source) | ||
| 45 | + { | ||
| 46 | + g_source_destroy((GSource *) object->source); | ||
| 47 | + object->source = NULL; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + if(object->hPipe) | ||
| 51 | + { | ||
| 52 | + closehandle(object->hPipe); | ||
| 53 | + object->hPipe = 0; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | +} |