diff options
author | daniel <danieruru@gmail.com> | 2013-01-30 13:16:17 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-30 13:16:17 +0900 |
commit | 54394d26b686702091e584d524ad77bfbb469fd4 (patch) | |
tree | 506f3f5bcc06f0c00625802904e2168903cb01fd /libvxi11client/perlbits/perlglue.c | |
parent | af2ad8e37d852f66d499125e75fca92762463678 (diff) |
Data lengths sent to the server shouldn't include the terminator.
Fix up how the handle gets copied out into perl
Diffstat (limited to 'libvxi11client/perlbits/perlglue.c')
-rw-r--r-- | libvxi11client/perlbits/perlglue.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libvxi11client/perlbits/perlglue.c b/libvxi11client/perlbits/perlglue.c index 259a652..5c6448b 100644 --- a/libvxi11client/perlbits/perlglue.c +++ b/libvxi11client/perlbits/perlglue.c @@ -12,13 +12,13 @@ static GAsyncQueue* interruptqueue; typedef struct { - char* handle; + gchar* handle; } Event; static Event* lastevent = NULL; +// perl is responsible for freeing the handle static void freeevent(Event* event) { - g_free(event->handle); g_free(event); } @@ -29,11 +29,9 @@ static void freelast() { } } -static void interruptcallback(char* handle) { +static void interruptcallback(gchar* handle) { Event* event = g_malloc(sizeof(Event)); - int handlelen = strlen(handle); - event->handle = g_malloc(handlelen + 1); - strcpy(event->handle, handle); + event->handle = handle; g_async_queue_push(interruptqueue, event); } @@ -76,11 +74,12 @@ char* glue_wait_for_interrupt(unsigned int timeout) { // if we have a timeout pop with a time out // otherwise block until an interrupt happens + freelast(); + if (timeout > 0) { GTimeVal whentotimeout; g_get_current_time(&whentotimeout); g_time_val_add(&whentotimeout, timeout * 1000); - freelast(); lastevent = (Event*) g_async_queue_timed_pop(interruptqueue, &whentotimeout); } else { |