[Spice-devel] [PATCH] use constructor/destructor macros
Frediano Ziglio
fziglio at redhat.com
Wed Mar 23 15:23:57 UTC 2016
Initialize global images at load time:
- make sure these stuff are initialized without using runtime
resources;
- make sure stuff are initialize really earlier.
Do not use atexit function but a destructor.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/red-qxl.c | 7 -------
server/reds.c | 7 +------
spice-common | 2 +-
3 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/server/red-qxl.c b/server/red-qxl.c
index 3fd5c12..fbce510 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -961,13 +961,6 @@ void red_qxl_init(RedsState *reds, QXLInstance *qxl)
spice_return_if_fail(qxl != NULL);
- static gsize initialized = FALSE;
- if (g_once_init_enter(&initialized)) {
- quic_init();
- sw_canvas_init();
- g_once_init_leave(&initialized, TRUE);
- }
-
qxl_state = spice_new0(QXLState, 1);
qxl_state->reds = reds;
qxl_state->qxl = qxl;
diff --git a/server/reds.c b/server/reds.c
index 254840b..38a369c 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2801,7 +2801,7 @@ static void reds_cleanup(RedsState *reds)
#endif
}
-static void reds_exit(void)
+SPICE_DESTRUCTOR_FUNC(reds_exit)
{
GList *l;
@@ -3335,7 +3335,6 @@ static void reds_init_vd_agent_resources(RedsState *reds)
static int do_spice_init(RedsState *reds, SpiceCoreInterface *core_interface)
{
- static gboolean first = TRUE;
spice_info("starting %s", VERSION);
if (core_interface->base.major_version != SPICE_INTERFACE_CORE_MAJOR) {
@@ -3416,10 +3415,6 @@ static int do_spice_init(RedsState *reds, SpiceCoreInterface *core_interface)
if (reds->allow_multiple_clients) {
spice_warning("spice: allowing multiple client connections");
}
- if (first) {
- atexit(reds_exit);
- first = FALSE;
- }
servers = g_list_prepend(servers, reds);
return 0;
diff --git a/spice-common b/spice-common
index 00db440..5b6be16 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 00db44087807335e74c8f65ea3e6fde0b684e7db
+Subproject commit 5b6be16b37370bb774aa3c2a7d5c41791fdc3a1e
--
2.5.5
More information about the Spice-devel
mailing list