]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Make pollGtk resetable.
authorOliver Kurth <okurth@vmware.com>
Tue, 12 Nov 2019 02:12:22 +0000 (18:12 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 12 Nov 2019 02:12:22 +0000 (18:12 -0800)
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().

open-vm-tools/lib/pollGtk/pollGtk.c

index 6d95bf0180cb1e7507765b5b6b3c8f418f07a763..2225dd43c3ac7951bdae68476a5b84826c6038ca 100644 (file)
@@ -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,