hey,

here is a patch to shutdown properly expedite.

i can't commit that patch right now, so feel free to push it in svn.

Vincent
Index: src/bin/engine_software_xlib.h
===================================================================
--- src/bin/engine_software_xlib.h	(revision 43338)
+++ src/bin/engine_software_xlib.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_software_xlib_args(int argc, char **argv);
 void engine_software_xlib_loop(void);
+void engine_software_xlib_shutdown(void);
 
 #endif
Index: src/bin/engine_software_gdi.c
===================================================================
--- src/bin/engine_software_gdi.c	(revision 43338)
+++ src/bin/engine_software_gdi.c	(working copy)
@@ -5,6 +5,7 @@
 
 
 static HWND window;
+static HINSTANCE instance;
 
 
 static LRESULT CALLBACK
@@ -175,7 +176,6 @@
 {
    WNDCLASS                       wc;
    RECT                           rect;
-   HINSTANCE                      instance;
    HDC                            dc;
    Evas_Engine_Info_Software_Gdi *einfo;
    DWORD                          style;
@@ -294,3 +294,11 @@
 
    goto again;
 }
+
+void
+engine_software_gdi_shutdown(void)
+{
+   DestroyWindow(window);
+   UnregisterClass("Evas_Software_Gdi_Test", instance);
+   FreeLibrary(instance);
+}
Index: src/bin/engine_software_ddraw.h
===================================================================
--- src/bin/engine_software_ddraw.h	(revision 43338)
+++ src/bin/engine_software_ddraw.h	(working copy)
@@ -9,6 +9,7 @@
 
 int  engine_software_ddraw_args(int argc, char **argv);
 void engine_software_ddraw_loop(void);
+void engine_software_ddraw_shutdown(void);
 
 
 #ifdef __cplusplus
Index: src/bin/engine_software_16_ddraw.cpp
===================================================================
--- src/bin/engine_software_16_ddraw.cpp	(revision 43338)
+++ src/bin/engine_software_16_ddraw.cpp	(working copy)
@@ -5,6 +5,7 @@
 
 
 static HWND window;
+static HINSTANCE instance;
 
 
 static int
@@ -267,7 +268,6 @@
 {
    WNDCLASS                            wc;
    RECT                                rect;
-   HINSTANCE                           instance;
    LPDIRECTDRAW                        object;
    LPDIRECTDRAWSURFACE                 surface_primary;
    LPDIRECTDRAWSURFACE                 surface_back;
@@ -337,7 +337,7 @@
                          &surface_back,
                          &surface_source,
                          &depth))
-        goto destroy_window;
+     goto destroy_window;
 
    evas_output_method_set(evas, evas_render_method_lookup("software_16_ddraw"));
    einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(evas);
@@ -393,3 +393,11 @@
 
    goto again;
 }
+
+void
+engine_software_16_ddraw_shutdown(void)
+{
+   DestroyWindow(window);
+   UnregisterClass("Evas_Software_16_DDraw_Test", instance);
+   FreeLibrary(instance);
+}
Index: src/bin/engine_software_gdi.h
===================================================================
--- src/bin/engine_software_gdi.h	(revision 43338)
+++ src/bin/engine_software_gdi.h	(working copy)
@@ -9,6 +9,7 @@
 
 int  engine_software_gdi_args(int argc, char **argv);
 void engine_software_gdi_loop(void);
+void engine_software_gdi_shutdown(void);
 
 
 #ifdef __cplusplus
Index: src/bin/engine_quartz.h
===================================================================
--- src/bin/engine_quartz.h	(revision 43338)
+++ src/bin/engine_quartz.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_quartz_args(int argc, char **argv);
 void engine_quartz_loop(void);
+void engine_quartz_shutdown(void);
 
 #endif
Index: src/bin/engine_xrender_x11.c
===================================================================
--- src/bin/engine_xrender_x11.c	(revision 43338)
+++ src/bin/engine_xrender_x11.c	(working copy)
@@ -36,7 +36,7 @@
    if (!einfo)
      {
 	printf("Evas does not support the XRender X11 Engine\n");
-	return 0;
+	goto close_display;
      }
 
    einfo->info.backend = EVAS_ENGINE_INFO_XRENDER_BACKEND_XLIB;
@@ -59,12 +59,14 @@
 		       CWBackPixmap | CWBorderPixel |
 		       CWBitGravity | CWEventMask,
 		       &attr);
+   if (!win)
+     goto close_display;
    einfo->info.drawable = win;
 
    if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
      {
 	printf("Evas can not setup the informations of the XRender X11 Engine\n");
-        return 0;
+	goto destroy_window;
      }
 
    XStoreName(disp, win, "Expedite - Evas Test Suite");
@@ -80,6 +82,13 @@
    while (!first_expose)
      engine_xrender_x11_loop();
    return 1;
+
+ destroy_window:
+   XDestroyWindow(disp, win);
+ close_display:
+   XCloseDisplay(disp);
+
+   return 0;
 }
 
 void
@@ -204,3 +213,10 @@
      }
    goto again;
 }
+
+void
+engine_xrender_x11_shutdown(void)
+{
+   XDestroyWindow(disp, win);
+   XCloseDisplay(disp);
+}
Index: src/bin/engine_quartz.m
===================================================================
--- src/bin/engine_quartz.m	(revision 43338)
+++ src/bin/engine_quartz.m	(working copy)
@@ -257,3 +257,9 @@
    [event release];
    [NSAutoreleasePool release];
 }
+
+void
+engine_quartz_shutdown(void)
+{
+  /* If someone knows what to do here... */
+}
Index: src/bin/engine_xrender_x11.h
===================================================================
--- src/bin/engine_xrender_x11.h	(revision 43338)
+++ src/bin/engine_xrender_x11.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_xrender_x11_args(int argc, char **argv);
 void engine_xrender_x11_loop(void);
+void engine_xrender_x11_shutdown(void);
 
 #endif
Index: src/bin/engine_software_16_ddraw.h
===================================================================
--- src/bin/engine_software_16_ddraw.h	(revision 43338)
+++ src/bin/engine_software_16_ddraw.h	(working copy)
@@ -9,6 +9,7 @@
 
 int  engine_software_16_ddraw_args(int argc, char **argv);
 void engine_software_16_ddraw_loop(void);
+void engine_software_16_ddraw_shutdown(void);
 
 
 #ifdef __cplusplus
Index: src/bin/engine_fb.c
===================================================================
--- src/bin/engine_fb.c	(revision 43338)
+++ src/bin/engine_fb.c	(working copy)
@@ -46,3 +46,9 @@
 {
    return;
 }
+
+void
+engine_fb_shutdown(void)
+{
+   return;
+}
Index: src/bin/engine_software_16_x11.c
===================================================================
--- src/bin/engine_software_16_x11.c	(revision 43338)
+++ src/bin/engine_software_16_x11.c	(working copy)
@@ -36,7 +36,7 @@
    if (!einfo)
      {
 	printf("Evas does not support the Software 16bit X11 Engine\n");
-	return 0;
+	goto close_display;
      }
 
    einfo->info.display = disp;
@@ -57,11 +57,14 @@
 		       CWBackPixmap | CWBorderPixel |
 		       CWBitGravity | CWEventMask,
 		       &attr);
+   if (!win)
+     goto close_display;
+
    einfo->info.drawable = win;
    if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
      {
 	printf("Evas can not setup the informations of the Software 16bit X11 Engine\n");
-	return 0;
+	goto destroy_window;
      }
 
    XStoreName(disp, win, "Expedite - Evas Test Suite");
@@ -77,6 +80,13 @@
    while (!first_expose)
      engine_software_16_x11_loop();
    return 1;
+
+ destroy_window:
+   XDestroyWindow(disp, win);
+ close_display:
+   XCloseDisplay(disp);
+
+   return 0;
 }
 
 void
@@ -201,3 +211,10 @@
      }
    goto again;
 }
+
+void
+engine_software_16_x11_shutdown(void)
+{
+   XDestroyWindow(disp, win);
+   XCloseDisplay(disp);
+}
Index: src/bin/engine_fb.h
===================================================================
--- src/bin/engine_fb.h	(revision 43338)
+++ src/bin/engine_fb.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_fb_args(int argc, char **argv);
 void engine_fb_loop(void);
+void engine_fb_shutdown(void);
 
 #endif
Index: src/bin/engine_software_16_x11.h
===================================================================
--- src/bin/engine_software_16_x11.h	(revision 43338)
+++ src/bin/engine_software_16_x11.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_software_16_x11_args(int argc, char **argv);
 void engine_software_16_x11_loop(void);
+void engine_software_16_x11_shutdown(void);
 
 #endif
Index: src/bin/engine_directfb.c
===================================================================
--- src/bin/engine_directfb.c	(revision 43338)
+++ src/bin/engine_directfb.c	(working copy)
@@ -275,3 +275,14 @@
 	  }
      }
 }
+
+void
+engine_directfb_shutdown(void)
+{
+   DFBCHECK(_input_event->Release(_input_event));
+   DFBCHECK(_window_event->Release(_window_event));
+   DFBCHECK(_dfb_surface->Release(_dfb_surface));
+   DFBCHECK(_dfb_window->Release(_dfb_window));
+   DFBCHECK(_layer->Release(_layer));
+   DFBCHECK(_dfb->Release(_dfb));
+}
Index: src/bin/engine_software_16_wince.c
===================================================================
--- src/bin/engine_software_16_wince.c	(revision 43338)
+++ src/bin/engine_software_16_wince.c	(working copy)
@@ -215,10 +215,7 @@
    wc.lpszClassName = L"Evas_Software_16_WinCE_Test";
 
    if(!RegisterClass(&wc))
-     {
-        FreeLibrary(instance);
-        return 0;
-     }
+     goto free_library;
 
    SetRect(&rect, 0, 0,
            GetSystemMetrics(SM_CXSCREEN),
@@ -233,11 +230,7 @@
                            rect.bottom - rect.top,
                            NULL, NULL, instance, NULL);
    if (!window)
-     {
-        UnregisterClass(L"Evas_Software_16_WinCE_Test", instance);
-        FreeLibrary(instance);
-        return 0;
-     }
+     goto unregister_class;
 
    /* hide top level windows (Task bar, SIP and SIP button */
    task_bar = FindWindow(L"HHTaskBar", NULL);
@@ -251,12 +244,7 @@
    EnableWindow(sip_icon, FALSE);
 
    if (!_wince_hardware_keys_register(window))
-     {
-        DestroyWindow(window);
-        UnregisterClass(L"Evas_Software_16_WinCE_Test", instance);
-        FreeLibrary(instance);
-        return 0;
-     }
+     goto destroy_window;
 
    evas_output_method_set(evas, evas_render_method_lookup("software_16_wince"));
 
@@ -264,10 +252,7 @@
    if (!einfo)
      {
         printf("Evas does not support the 16bit Software WinCE Engine\n");
-        DestroyWindow(window);
-        UnregisterClass(L"Evas_Software_16_WinCE_Test", instance);
-        FreeLibrary(instance);
-        return 0;
+        goto destroy_window;
      }
 
    einfo->info.window = window;
@@ -278,10 +263,7 @@
    if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
      {
 	printf("Evas can not setup the informations of the 16 bits Software WinCE Engine\n");
-        DestroyWindow(window);
-        UnregisterClass(L"Evas_Software_16_WinCE_Test", instance);
-        FreeLibrary(instance);
-	return 0;
+        goto destroy_window;
      }
 
    _suspend = einfo->func.suspend;
@@ -292,6 +274,15 @@
    UpdateWindow(window);
 
    return 1;
+
+ destroy_window:
+   DestroyWindow(window);
+ unregister_class:
+   UnregisterClass(L"Evas_Software_16_WinCE_Test", instance);
+ free_library:
+   FreeLibrary(instance);
+
+   return 0;
 }
 
 void
@@ -310,3 +301,11 @@
 
    goto again;
 }
+
+void
+engine_software_16_wince_shutdown(void)
+{
+   DestroyWindow(window);
+   UnregisterClass(L"Evas_Software_16_WinCE_Test", instance);
+   FreeLibrary(instance);
+}
Index: src/bin/engine_directfb.h
===================================================================
--- src/bin/engine_directfb.h	(revision 43338)
+++ src/bin/engine_directfb.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_directfb_args(int argc, char **argv);
 void engine_directfb_loop(void);
+void engine_directfb_shutdown(void);
 
 #endif
Index: src/bin/engine_software_16_wince.h
===================================================================
--- src/bin/engine_software_16_wince.h	(revision 43338)
+++ src/bin/engine_software_16_wince.h	(working copy)
@@ -4,6 +4,7 @@
 
 int  engine_software_16_wince_args(int argc, char **argv);
 void engine_software_16_wince_loop(void);
+void engine_software_16_wince_shutdown(void);
 
 
 #endif /* __ENGINE_SOFTWARE_16_WINCE_H__ */
Index: src/bin/engine_gl_x11.c
===================================================================
--- src/bin/engine_gl_x11.c	(revision 43338)
+++ src/bin/engine_gl_x11.c	(working copy)
@@ -36,7 +36,7 @@
    if (!einfo)
      {
 	printf("Evas does not support the OpenGL X11 Engine\n");
-	return 0;
+	goto close_display;
      }
 
    einfo->info.display = disp;
@@ -60,11 +60,14 @@
 		       CWBackPixmap | CWBorderPixel |
 		       CWBitGravity | CWEventMask,
 		       &attr);
+   if (!win)
+     goto close_display;
+
    einfo->info.drawable = win;
    if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
      {
 	printf("Evas can not setup the informations of the OpenGL X11 Engine\n");
-        return 0;
+	goto destroy_window;
      }
 
    XStoreName(disp, win, "Expedite - Evas Test Suite");
@@ -80,6 +83,13 @@
    while (!first_expose)
      engine_gl_x11_loop();
    return 1;
+
+ destroy_window:
+   XDestroyWindow(disp, win);
+ close_display:
+   XCloseDisplay(disp);
+
+   return 0;
 }
 
 void
@@ -204,3 +214,10 @@
      }
    goto again;
 }
+
+void
+engine_gl_x11_shutdown(void)
+{
+   XDestroyWindow(disp, win);
+   XCloseDisplay(disp);
+}
Index: src/bin/engine_software_sdl.c
===================================================================
--- src/bin/engine_software_sdl.c	(revision 43338)
+++ src/bin/engine_software_sdl.c	(working copy)
@@ -178,3 +178,8 @@
           }
      }
 }
+
+void
+engine_software_sdl_shutdown(void)
+{
+}
Index: src/bin/engine_gl_x11.h
===================================================================
--- src/bin/engine_gl_x11.h	(revision 43338)
+++ src/bin/engine_gl_x11.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_gl_x11_args(int argc, char **argv);
 void engine_gl_x11_loop(void);
+void engine_gl_x11_shutdown(void);
 
 #endif
Index: src/bin/engine_direct3d.cpp
===================================================================
--- src/bin/engine_direct3d.cpp	(revision 43338)
+++ src/bin/engine_direct3d.cpp	(working copy)
@@ -5,6 +5,7 @@
 
 
 static HWND window;
+static HINSTANCE instance;
 
 
 static LRESULT CALLBACK
@@ -175,7 +176,6 @@
 {
    WNDCLASS                   wc;
    RECT                       rect;
-   HINSTANCE                  instance;
    HDC                        dc;
    MSG                        msg;
    Evas_Engine_Info_Direct3D *einfo;
@@ -289,3 +289,11 @@
 
    goto again;
 }
+
+void
+engine_direct3d_shutdown(void)
+{
+   DestroyWindow(window);
+   UnregisterClass("Evas_Direct3D_Test", instance);
+   FreeLibrary(instance);
+}
Index: src/bin/engine_software_sdl.h
===================================================================
--- src/bin/engine_software_sdl.h	(revision 43338)
+++ src/bin/engine_software_sdl.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_software_sdl_args(int argc, char **argv);
 void engine_software_sdl_loop(void);
+void engine_software_sdl_shutdown(void);
 
 #endif
Index: src/bin/engine_software_ddraw.cpp
===================================================================
--- src/bin/engine_software_ddraw.cpp	(revision 43338)
+++ src/bin/engine_software_ddraw.cpp	(working copy)
@@ -5,6 +5,7 @@
 
 
 static HWND window;
+static HINSTANCE instance;
 
 
 static LRESULT CALLBACK
@@ -175,7 +176,6 @@
 {
    WNDCLASS                         wc;
    RECT                             rect;
-   HINSTANCE                        instance;
    HDC                              dc;
    Evas_Engine_Info_Software_DDraw *einfo;
    DWORD                            style;
@@ -292,3 +292,11 @@
 
    goto again;
 }
+
+void
+engine_software_ddraw_shutdown(void)
+{
+   DestroyWindow(window);
+   UnregisterClass("Evas_Software_DDraw_Test", instance);
+   FreeLibrary(instance);
+}
Index: src/bin/engine_gl_glew.h
===================================================================
--- src/bin/engine_gl_glew.h	(revision 43338)
+++ src/bin/engine_gl_glew.h	(working copy)
@@ -4,6 +4,7 @@
 
 int  engine_gl_glew_args(int argc, char **argv);
 void engine_gl_glew_loop(void);
+void engine_gl_glew_shutdown(void);
 
 
 #endif /* __ENGINE_GL_GLEW_H__ */
Index: src/bin/engine_software_xcb.c
===================================================================
--- src/bin/engine_software_xcb.c	(revision 43338)
+++ src/bin/engine_software_xcb.c	(working copy)
@@ -92,7 +92,7 @@
    if (!einfo)
      {
 	printf("Evas does not support the Software XCB Engine\n");
-	return 0;
+	goto close_connection;
      }
 
    einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB;
@@ -121,6 +121,8 @@
    value_list[5]  = einfo->info.colormap;
 
    win = xcb_generate_id(conn);
+   if (!win)
+     goto close_connection;
    xcb_create_window(conn,
                      einfo->info.depth,
                      win, screen->root, 0, 0, win_w, win_h, 0,
@@ -135,7 +137,7 @@
    if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
      {
 	printf("Evas can not setup the informations of the Software XCB Engine\n");
-        return 0;
+	goto destroy_window;
      }
 
 /*    XStoreName(disp, win, "Expedite - Evas Test Suite"); */
@@ -206,6 +208,13 @@
    while (!first_expose)
      engine_software_xcb_loop();
    return 1;
+
+ destroy_window:
+   xcb_destroy_window(conn, win);
+ close_connection:
+   xcb_disconnect(conn);
+
+   return 0;
 }
 
 void
@@ -290,7 +299,7 @@
            xcb_key_press_event_t *e;
            xcb_key_symbols_t *kss;
            xcb_keysym_t       ks;
-           char              *str;
+           char              *str = "";
 
            e = (xcb_key_press_event_t *)ev;
 
@@ -329,7 +338,7 @@
              str = "Escape";
            if (ks == XK_Return)
              str = "Return";
-           if (ks == 71)
+           if (ks == 113)
              str = "q";
 
            evas_event_feed_key_down(evas, str, str, NULL, NULL, 0, NULL);
@@ -342,7 +351,7 @@
            xcb_key_release_event_t *e;
            xcb_key_symbols_t *kss;
            xcb_keysym_t       ks;
-           char              *str;
+           char              *str = "";
 
            e = (xcb_key_release_event_t *)ev;
 
@@ -367,7 +376,7 @@
              str = "Escape";
            if (ks == XK_Return)
              str = "Return";
-           if (ks == 71)
+           if (ks == 113)
              str = "q";
 
            evas_event_feed_key_up(evas, str, str, NULL, NULL, 0, NULL);
@@ -383,3 +392,10 @@
 
    goto again;
 }
+
+void
+engine_software_xcb_shutdown(void)
+{
+   xcb_destroy_window(conn, win);
+   xcb_disconnect(conn);
+}
Index: src/bin/engine_software_xcb.h
===================================================================
--- src/bin/engine_software_xcb.h	(revision 43338)
+++ src/bin/engine_software_xcb.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_software_xcb_args(int argc, char **argv);
 void engine_software_xcb_loop(void);
+void engine_software_xcb_shutdown(void);
 
 #endif
Index: src/bin/main.c
===================================================================
--- src/bin/main.c	(revision 43338)
+++ src/bin/main.c	(working copy)
@@ -7,6 +7,7 @@
 static char *datadir = NULL;
 static int go = 1;
 static void (*loop_func) (void) = NULL;
+static void (*shutdown_func) (void) = NULL;
 
 /* this guarantees that "random" numbers will always be the same set regardless
  * of what os/system/etc we are on - as often i need just some "random" set of
@@ -1118,6 +1119,12 @@
    loop_func();
 }
 
+void
+engine_shutdown(void)
+{
+   shutdown_func();
+}
+
 static int
 _engine_go(void)
 {
@@ -1191,67 +1198,115 @@
    profile_ok = _profile_parse(argc, argv);
 #if HAVE_EVAS_SOFTWARE_XLIB
    if (engine_software_xlib_args(argc, argv))
-     loop_func = engine_software_xlib_loop;
+     {
+	loop_func = engine_software_xlib_loop;
+	shutdown_func = engine_software_xlib_shutdown;
+     }
 #endif
 #if HAVE_EVAS_XRENDER_X11
    if (engine_xrender_x11_args(argc, argv))
-     loop_func = engine_xrender_x11_loop;
+     {
+	loop_func = engine_xrender_x11_loop;
+	shutdown_func = engine_xrender_x11_shutdown;
+     }
 #endif
 #if HAVE_EVAS_OPENGL_X11
    if (engine_gl_x11_args(argc, argv))
-     loop_func = engine_gl_x11_loop;
+     {
+	loop_func = engine_gl_x11_loop;
+	shutdown_func = engine_gl_x11_shutdown;
+     }
 #endif
 #if HAVE_EVAS_SOFTWARE_XCB
    if (engine_software_xcb_args(argc, argv))
-     loop_func = engine_software_xcb_loop;
+     {
+	loop_func = engine_software_xcb_loop;
+	shutdown_func = engine_software_xcb_shutdown;
+     }
 #endif
 #if HAVE_EVAS_XRENDER_XCB
    if (engine_xrender_xcb_args(argc, argv))
-     loop_func = engine_xrender_xcb_loop;
+     {
+	loop_func = engine_xrender_xcb_loop;
+	shutdown_func = engine_xrender_xcb_shutdown;
+     }
 #endif
 #if HAVE_EVAS_SOFTWARE_GDI
    if (engine_software_gdi_args(argc, argv))
-     loop_func = engine_software_gdi_loop;
+     {
+	loop_func = engine_software_gdi_loop;
+	shutdown_func = engine_software_gdi_shutdown;
+     }
 #endif
 #if HAVE_EVAS_SOFTWARE_DDRAW
    if (engine_software_ddraw_args(argc, argv))
-     loop_func = engine_software_ddraw_loop;
+     {
+	loop_func = engine_software_ddraw_loop;
+	shutdown_func = engine_software_ddraw_shutdown;
+     }
 #endif
 #if HAVE_EVAS_DIRECT3D
    if (engine_direct3d_args(argc, argv))
-     loop_func = engine_direct3d_loop;
+     {
+	loop_func = engine_direct3d_loop;
+	shutdown_func = engine_direct3d_shutdown;
+     }
 #endif
 #if HAVE_EVAS_OPENGL_GLEW
    if (engine_gl_glew_args(argc, argv))
-     loop_func = engine_gl_glew_loop;
+     {
+	loop_func = engine_gl_glew_loop;
+	shutdown_func = engine_gl_glew_shutdown;
+     }
 #endif
 #if HAVE_EVAS_SOFTWARE_SDL
    if (engine_software_sdl_args(argc, argv))
-     loop_func = engine_software_sdl_loop;
+     {
+	loop_func = engine_software_sdl_loop;
+	shutdown_func = engine_software_sdl_shutdown;
+     }
 #endif
 #if HAVE_EVAS_FB
    if (engine_fb_args(argc, argv))
-     loop_func = engine_fb_loop;
+     {
+	loop_func = engine_fb_loop;
+	shutdown_func = engine_fb_shutdown;
+     }
 #endif
 #if HAVE_EVAS_DIRECTFB
    if (engine_directfb_args(argc, argv))
-     loop_func = engine_directfb_loop;
+     {
+	loop_func = engine_directfb_loop;
+	shutdown_func = engine_directfb_shutdown;
+     }
 #endif
 #if HAVE_EVAS_QUARTZ
    if (engine_quartz_args(argc, argv))
-     loop_func = engine_quartz_loop;
+     {
+	loop_func = engine_quartz_loop;
+	shutdown_func = engine_quartz_shutdown;
+     }
 #endif
 #if HAVE_EVAS_SOFTWARE_16_X11
    if (engine_software_16_x11_args(argc, argv))
-     loop_func = engine_software_16_x11_loop;
+     {
+	loop_func = engine_software_16_x11_loop;
+	shutdown_func = engine_software_16_x11_shutdown;
+     }
 #endif
 #if HAVE_EVAS_SOFTWARE_16_DDRAW
    if (engine_software_16_ddraw_args(argc, argv))
-     loop_func = engine_software_16_ddraw_loop;
+     {
+	loop_func = engine_software_16_ddraw_loop;
+	shutdown_func = engine_software_16_ddraw_shutdown;
+     }
 #endif
 #if HAVE_EVAS_SOFTWARE_16_WINCE
    if (engine_software_16_wince_args(argc, argv))
-     loop_func = engine_software_16_wince_loop;
+     {
+	loop_func = engine_software_16_wince_loop;
+	shutdown_func = engine_software_16_wince_shutdown;
+     }
 #endif
    if ((!loop_func) || (!profile_ok))
      {
@@ -1377,5 +1432,6 @@
    evas_free(evas);
 
    evas_shutdown();
+   engine_shutdown();
    return 0;
 }
Index: src/bin/engine_xrender_xcb.c
===================================================================
--- src/bin/engine_xrender_xcb.c	(revision 43338)
+++ src/bin/engine_xrender_xcb.c	(working copy)
@@ -111,7 +111,7 @@
    if (!einfo)
      {
 	printf("Evas does not support the XRender XCB Engine\n");
-	return 0;
+	goto close_connection;
      }
 
    einfo->info.backend = EVAS_ENGINE_INFO_XRENDER_BACKEND_XCB;
@@ -136,6 +136,8 @@
    value_list[5]  =screen->default_colormap;
 
    win = xcb_generate_id(conn);
+   if (!win)
+     goto close_connection;
    xcb_create_window(conn,
                      screen->root_depth,
                      win, screen->root, 0, 0, win_w, win_h, 0,
@@ -148,7 +150,7 @@
    if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
      {
 	printf("Evas can not setup the informations of the XRender XCB Engine\n");
-        return 0;
+	goto destroy_window;
      }
 
    xcb_map_window(conn, win);
@@ -221,6 +223,13 @@
    while (!first_expose)
      engine_xrender_xcb_loop();
    return 1;
+
+ destroy_window:
+   xcb_destroy_window(conn, win);
+ close_connection:
+   xcb_disconnect(conn);
+
+   return 0;
 }
 
 void
@@ -398,3 +407,10 @@
 
    goto again;
 }
+
+void
+engine_xrender_xcb_shutdown(void)
+{
+   xcb_destroy_window(conn, win);
+   xcb_disconnect(conn);
+}
Index: src/bin/engine_direct3d.h
===================================================================
--- src/bin/engine_direct3d.h	(revision 43338)
+++ src/bin/engine_direct3d.h	(working copy)
@@ -9,6 +9,7 @@
 
 int  engine_direct3d_args(int argc, char **argv);
 void engine_direct3d_loop(void);
+void engine_direct3d_shutdown(void);
 
 
 #ifdef __cplusplus
Index: src/bin/engine_xrender_xcb.h
===================================================================
--- src/bin/engine_xrender_xcb.h	(revision 43338)
+++ src/bin/engine_xrender_xcb.h	(working copy)
@@ -3,5 +3,6 @@
 
 int  engine_xrender_xcb_args(int argc, char **argv);
 void engine_xrender_xcb_loop(void);
+void engine_xrender_xcb_shutdown(void);
 
 #endif
Index: src/bin/engine_software_xlib.c
===================================================================
--- src/bin/engine_software_xlib.c	(revision 43338)
+++ src/bin/engine_software_xlib.c	(working copy)
@@ -36,7 +36,7 @@
    if (!einfo)
      {
 	printf("Evas does not support the Software Xlib Engine\n");
-	return 0;
+	goto close_display;
      }
 
    einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB;
@@ -64,11 +64,14 @@
 		       CWBackPixmap | CWBorderPixel |
 		       CWBitGravity | CWEventMask,
 		       &attr);
+   if (!win)
+     goto close_display;
+
    einfo->info.drawable = win;
    if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
      {
 	printf("Evas can not setup the informations of the Software Xlib Engine\n");
-        return 0;
+	goto destroy_window;
      }
 
    XStoreName(disp, win, "Expedite - Evas Test Suite");
@@ -84,6 +87,13 @@
    while (!first_expose)
      engine_software_xlib_loop();
    return 1;
+
+ destroy_window:
+   XDestroyWindow(disp, win);
+ close_display:
+   XCloseDisplay(disp);
+
+   return 0;
 }
 
 void
@@ -208,3 +218,10 @@
      }
    goto again;
 }
+
+void
+engine_software_xlib_shutdown(void)
+{
+   XDestroyWindow(disp, win);
+   XCloseDisplay(disp);
+}
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to