# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1362156668 0 # Node ID c836603d3f149cc0db1876b05018e7fa8cfdc3a8 # Parent 02a23143334c675c846ee5c70f7ec95d2b177ffa Add dw_shutdown() function which does the same thing as dw_exit() ... except it doesn't actually end the process. Useful for bindings that are expecting to do their own cleanup after the script exits. diff -r 02a23143334c -r c836603d3f14 dw.h --- a/dw.h Fri Mar 01 13:01:59 2013 +0000 +++ b/dw.h Fri Mar 01 16:51:08 2013 +0000 @@ -1679,6 +1679,7 @@ void API dw_thread_end(void); DWTID API dw_thread_id(void); void API dw_exit(int exitcode); +void API dw_shutdown(void); HWND API dw_render_new(unsigned long id); void API dw_color_foreground_set(unsigned long value); void API dw_color_background_set(unsigned long value); diff -r 02a23143334c -r c836603d3f14 gtk/dw.c --- a/gtk/dw.c Fri Mar 01 13:01:59 2013 +0000 +++ b/gtk/dw.c Fri Mar 01 16:51:08 2013 +0000 @@ -10157,15 +10157,24 @@ /* * Cleanly terminates a DW session, should be signal handler safe. + */ +void dw_shutdown(void) +{ + if ( dbgfp != NULL ) + { + fclose( dbgfp ); + dbgfp = NULL; + } +} + +/* + * Cleanly terminates a DW session, should be signal handler safe. * Parameters: * exitcode: Exit code reported to the operating system. */ void dw_exit(int exitcode) { - if ( dbgfp != NULL ) - { - fclose( dbgfp ); - } + dw_shutdown(); exit(exitcode); } diff -r 02a23143334c -r c836603d3f14 gtk3/dw.c --- a/gtk3/dw.c Fri Mar 01 13:01:59 2013 +0000 +++ b/gtk3/dw.c Fri Mar 01 16:51:08 2013 +0000 @@ -8396,6 +8396,13 @@ /* * Cleanly terminates a DW session, should be signal handler safe. + */ +void dw_shutdown(void) +{ +} + +/* + * Cleanly terminates a DW session, should be signal handler safe. * Parameters: * exitcode: Exit code reported to the operating system. */ diff -r 02a23143334c -r c836603d3f14 mac/dw.m --- a/mac/dw.m Fri Mar 01 13:01:59 2013 +0000 +++ b/mac/dw.m Fri Mar 01 16:51:08 2013 +0000 @@ -3216,15 +3216,23 @@ /* * Cleanly terminates a DW session, should be signal handler safe. - * Parameters: - * exitcode: Exit code reported to the operating system. - */ -void API dw_exit(int exitcode) + */ +void API dw_shutdown(void) { #if !defined(GARBAGE_COLLECT) pool = pthread_getspecific(_dw_pool_key); [pool drain]; #endif +} + +/* + * Cleanly terminates a DW session, should be signal handler safe. + * Parameters: + * exitcode: Exit code reported to the operating system. + */ +void API dw_exit(int exitcode) +{ + dw_shutdown(); exit(exitcode); } @@ -8299,7 +8307,8 @@ [window setDelegate:view]; [window setAutorecalculatesKeyViewLoop:YES]; [window setAcceptsMouseMovedEvents:YES]; - [view release]; + [window setReleasedWhenClosed:YES]; + [view autorelease]; /* Enable full screen mode on resizeable windows */ if(flStyle & DW_FCF_SIZEBORDER) diff -r 02a23143334c -r c836603d3f14 os2/dw.c --- a/os2/dw.c Fri Mar 01 13:01:59 2013 +0000 +++ b/os2/dw.c Fri Mar 01 16:51:08 2013 +0000 @@ -11836,10 +11836,8 @@ /* * Cleanly terminates a DW session, should be signal handler safe. - * Parameters: - * exitcode: Exit code reported to the operating system. - */ -void API dw_exit(int exitcode) + */ +void API dw_shutdown(void) { /* Destroy the menu message window */ dw_window_destroy(hwndApp); @@ -11852,7 +11850,10 @@ /* Deinit the GBM */ if(_gbm_deinit) + { _gbm_deinit(); + _gbm_deinit = NULL; + } #ifdef UNICODE /* Free the conversion object */ @@ -11870,7 +11871,16 @@ DosFreeModule(pmprintf); DosFreeModule(pmmerge); DosFreeModule(gbm); - +} + +/* + * Cleanly terminates a DW session, should be signal handler safe. + * Parameters: + * exitcode: Exit code reported to the operating system. + */ +void API dw_exit(int exitcode) +{ + dw_shutdown(); /* And finally exit */ exit(exitcode); } diff -r 02a23143334c -r c836603d3f14 os2/dw.def --- a/os2/dw.def Fri Mar 01 13:01:59 2013 +0000 +++ b/os2/dw.def Fri Mar 01 16:51:08 2013 +0000 @@ -12,7 +12,6 @@ dw_beep @13 dw_messagebox @14 dw_debug @15 - dw_environment_query @16 dw_exec @17 dw_browse @18 @@ -24,6 +23,7 @@ dw_main_iteration @24 dw_app_dir @25 dw_main_quit @26 + dw_shutdown @27 dw_box_new @40 dw_groupbox_new @41 diff -r 02a23143334c -r c836603d3f14 os2/dw.lnk --- a/os2/dw.lnk Fri Mar 01 13:01:59 2013 +0000 +++ b/os2/dw.lnk Fri Mar 01 16:51:08 2013 +0000 @@ -7,7 +7,6 @@ export dw_beep.13 export dw_messagebox.14 export dw_debug.15 - export dw_environment_query.16 export dw_exec.17 export dw_browse.18 @@ -19,6 +18,7 @@ export dw_main_iteration.24 export dw_app_dir.25 export dw_main_quit.26 +export dw_shutdown.27 export dw_box_new.40 export dw_groupbox_new.41 diff -r 02a23143334c -r c836603d3f14 win/dw-mingw.def --- a/win/dw-mingw.def Fri Mar 01 13:01:59 2013 +0000 +++ b/win/dw-mingw.def Fri Mar 01 16:51:08 2013 +0000 @@ -11,7 +11,6 @@ dw_beep @13 dw_messagebox @14 dw_debug @15 - dw_environment_query @16 dw_exec @17 dw_browse @18 @@ -23,6 +22,7 @@ dw_main_iteration @24 dw_app_dir @25 dw_main_quit @26 + dw_shutdown @27 dw_box_new @40 dw_groupbox_new @41 diff -r 02a23143334c -r c836603d3f14 win/dw.c --- a/win/dw.c Fri Mar 01 13:01:59 2013 +0000 +++ b/win/dw.c Fri Mar 01 16:51:08 2013 +0000 @@ -11331,10 +11331,8 @@ /* * Cleanly terminates a DW session, should be signal handler safe. - * Parameters: - * exitcode: Exit code reported to the operating system. - */ -void API dw_exit(int exitcode) + */ +void API dw_shutdown(void) { OleUninitialize(); #ifdef AEROGLASS @@ -11343,6 +11341,16 @@ #endif FreeLibrary(huxtheme); DestroyWindow(hwndTooltip); +} + +/* + * Cleanly terminates a DW session, should be signal handler safe. + * Parameters: + * exitcode: Exit code reported to the operating system. + */ +void API dw_exit(int exitcode) +{ + dw_shutdown(); exit(exitcode); } diff -r 02a23143334c -r c836603d3f14 win/dw.def --- a/win/dw.def Fri Mar 01 13:01:59 2013 +0000 +++ b/win/dw.def Fri Mar 01 16:51:08 2013 +0000 @@ -11,7 +11,6 @@ dw_beep @13 dw_messagebox @14 dw_debug @15 - dw_environment_query @16 dw_exec @17 dw_browse @18 @@ -23,6 +22,7 @@ dw_main_iteration @24 dw_app_dir @25 dw_main_quit @26 + dw_shutdown @27 dw_box_new @40 dw_groupbox_new @41