From: Oliver Kurth Date: Tue, 12 Nov 2019 02:12:22 +0000 (-0800) Subject: Make pollGtk resetable. X-Git-Tag: stable-11.1.0~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f48efc8e06529a63ab7574a97b41e6ff3846fd06;p=thirdparty%2Fopen-vm-tools.git Make pollGtk resetable. A simple poll implementation built on top of GLib, pollGtk can only be inited once in a program's lifetime. This works for product but not testcases. This patch changes the function static variable "inited" to be file static, and can be reset this variable in PollGtkExit(). --- diff --git a/open-vm-tools/lib/pollGtk/pollGtk.c b/open-vm-tools/lib/pollGtk/pollGtk.c index 6d95bf018..2225dd43c 100644 --- a/open-vm-tools/lib/pollGtk/pollGtk.c +++ b/open-vm-tools/lib/pollGtk/pollGtk.c @@ -127,7 +127,7 @@ typedef struct Poll { } Poll; static Poll *pollState; - +static volatile gsize inited = 0; static VMwareStatus PollGtkCallback(PollClassSet classSet, // IN @@ -297,6 +297,7 @@ PollGtkExit(void) g_free(poll); pollState = NULL; + inited = 0; } @@ -1473,8 +1474,6 @@ PollGtkBasicCallback(gpointer data) // IN: The eventEntry void Poll_InitGtk(void) { - static volatile gsize inited = 0; - static const PollImpl gtkImpl = { PollGtkInit,