From: Braden M. <br...@us...> - 2007-01-02 00:08:35
|
Update of /cvsroot/openvrml/openvrml/mozilla-plugin/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16735/mozilla-plugin/src Modified Files: openvrml.cpp Log Message: ScopeGuard as initially described by Alexandrescu and Marginean copies the callback function parameters to the guard implementation. This means that the callback is called with the values given when make_guard gets called--not whatever the values might be when execution in the scope completes. > > This changes OpenVRML's implementation of ScopeGuard to keep const references to the parameters in the guard implementation. Also, use of boost::multi_index::detail::scope_guard (where use of OpenVRML's ScopeGuard implementation is inconvenient) now explicitly gives a reference template parameter to the instantiation of make_guard to circumvent this problem. Index: openvrml.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** openvrml.cpp 6 Dec 2006 01:58:50 -0000 1.48 --- openvrml.cpp 2 Jan 2007 00:08:33 -0000 1.49 *************** *** 1123,1127 **** gchar ** openvrml_gtkplug_cmd_argv = 0; scope_guard openvrml_gtkplug_cmd_argv_guard = ! make_guard(g_strfreev, openvrml_gtkplug_cmd_argv); boost::ignore_unused_variable_warning(openvrml_gtkplug_cmd_argv_guard); const gchar * const openvrml_gtkplug_cmd = --- 1123,1128 ---- gchar ** openvrml_gtkplug_cmd_argv = 0; scope_guard openvrml_gtkplug_cmd_argv_guard = ! make_guard<void (*)(gchar **), gchar ** &>( ! g_strfreev, openvrml_gtkplug_cmd_argv); boost::ignore_unused_variable_warning(openvrml_gtkplug_cmd_argv_guard); const gchar * const openvrml_gtkplug_cmd = *************** *** 1137,1141 **** } else { GError * error = 0; ! scope_guard error_guard = make_guard(g_error_free, error); gboolean succeeded = g_shell_parse_argv(openvrml_gtkplug_cmd, --- 1138,1144 ---- } else { GError * error = 0; ! scope_guard error_guard = ! make_guard<void (*)(GError *), GError * &>(g_error_free, ! error); gboolean succeeded = g_shell_parse_argv(openvrml_gtkplug_cmd, *************** *** 1188,1192 **** gint * const standard_error = 0; GError * error = 0; ! scope_guard error_guard = make_guard(g_error_free, error); gboolean succeeded = g_spawn_async_with_pipes(working_dir, argv, --- 1191,1196 ---- gint * const standard_error = 0; GError * error = 0; ! scope_guard error_guard = ! make_guard<void (*)(GError *), GError * &>(g_error_free, error); gboolean succeeded = g_spawn_async_with_pipes(working_dir, argv, |