[mutter/wip/wayland] wayland: call meta_tty_destroy on init error



commit 615aee56c17cdfbe57b78bce2bc855e02e4a9edc
Author: Robert Bragg <robert linux intel com>
Date:   Mon Jan 30 10:49:18 2012 +0000

    wayland: call meta_tty_destroy on init error
    
    If there is some error while initializing wayland then we are now
    careful to ensure we call meta_tty_destroy() so that we put the VT back
    into text mode before exiting.

 src/wayland/meta-wayland.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index c072d4a..3831f26 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1535,12 +1535,18 @@ meta_wayland_init (void)
                               &wl_compositor_interface,
 			      compositor,
                               compositor_bind))
-    g_error ("Failed to register wayland compositor object");
+    {
+      g_printerr ("Failed to register wayland compositor object");
+      goto error;
+    }
 
   compositor->wayland_shm = wl_shm_init (compositor->wayland_display,
                                          &shm_callbacks);
   if (!compositor->wayland_shm)
-    g_error ("Failed to allocate setup wayland shm callbacks");
+    {
+      g_printerr ("Failed to allocate setup wayland shm callbacks");
+      goto error;
+    }
 
   compositor->wayland_loop =
     wl_display_get_event_loop (compositor->wayland_display);
@@ -1560,7 +1566,10 @@ meta_wayland_init (void)
   clutter_wayland_set_compositor_display (compositor->wayland_display);
 
   if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
-    g_error ("Failed to initialize Clutter");
+    {
+      g_printerr ("Failed to initialize Clutter");
+      goto error;
+    }
 
   compositor->stage = meta_wayland_stage_new ();
   clutter_stage_set_user_resizable (CLUTTER_STAGE (compositor->stage), FALSE);
@@ -1591,12 +1600,18 @@ meta_wayland_init (void)
 
   if (wl_display_add_global (compositor->wayland_display, &wl_shell_interface,
                              compositor, bind_shell) == NULL)
-    g_error ("Failed to register a global shell object");
+    {
+      g_printerr ("Failed to register a global shell object");
+      goto error;
+    }
 
   clutter_actor_show (compositor->stage);
 
   if (wl_display_add_socket (compositor->wayland_display, "wayland-0"))
-    g_error ("Failed to create socket");
+    {
+      g_printerr ("Failed to create socket");
+      goto error;
+    }
 
   wl_display_add_global (compositor->wayland_display,
                          &xserver_interface,
@@ -1616,7 +1631,10 @@ meta_wayland_init (void)
    */
 
   if (!start_xwayland (compositor))
-    g_error ("Failed to start X Wayland");
+    {
+      g_printerr ("Failed to start X Wayland");
+      goto error;
+    }
 
   putenv (g_strdup_printf ("DISPLAY=:%d", compositor->xwayland_display_index));
 
@@ -1626,6 +1644,10 @@ meta_wayland_init (void)
   compositor->init_loop = g_main_loop_new (NULL, FALSE);
 
   g_main_loop_run (compositor->init_loop);
+
+  return;
+error:
+  meta_tty_destroy (compositor->tty);
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]