From: Braden M. <br...@us...> - 2007-01-03 23:08:40
|
Update of /cvsroot/openvrml/openvrml/mozilla-plugin/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21055/mozilla-plugin/src Modified Files: openvrml.cpp Log Message: On second thought, retaining copies in the guard_impl is really the only safe thing to do (in the event someone wants to invoke make_guard with temporaries). The case where this is not desirable can be solved by using boost::ref in the call to make_guard. Index: openvrml.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/mozilla-plugin/src/openvrml.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** openvrml.cpp 2 Jan 2007 00:08:33 -0000 1.49 --- openvrml.cpp 3 Jan 2007 23:08:39 -0000 1.50 *************** *** 30,33 **** --- 30,34 ---- # include <boost/multi_index/detail/scope_guard.hpp> # include <boost/noncopyable.hpp> + # include <boost/ref.hpp> # include <boost/scoped_ptr.hpp> # include <mozilla-config.h> *************** *** 1109,1112 **** --- 1110,1114 ---- using std::vector; using boost::lexical_cast; + using boost::ref; this->window = GdkNativeWindow(ptrdiff_t(window.window)); *************** *** 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 = --- 1125,1129 ---- gchar ** openvrml_gtkplug_cmd_argv = 0; scope_guard openvrml_gtkplug_cmd_argv_guard = ! make_guard(g_strfreev, ref(openvrml_gtkplug_cmd_argv)); boost::ignore_unused_variable_warning(openvrml_gtkplug_cmd_argv_guard); const gchar * const 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, --- 1139,1143 ---- } else { GError * error = 0; ! scope_guard error_guard = make_guard(g_error_free, ref(error)); gboolean succeeded = g_shell_parse_argv(openvrml_gtkplug_cmd, *************** *** 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, --- 1190,1194 ---- gint * const standard_error = 0; GError * error = 0; ! scope_guard error_guard = make_guard(g_error_free, ref(error)); gboolean succeeded = g_spawn_async_with_pipes(working_dir, argv, |