After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 565487 - Glib::spawn_async* functions don't work with exceptions disabled
Glib::spawn_async* functions don't work with exceptions disabled
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-12-23 18:04 UTC by Jonathon Jongsma
Modified: 2008-12-24 22:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
spawn_no_exceptions.patch (19.66 KB, patch)
2008-12-24 22:11 UTC, Murray Cumming
committed Details | Review

Description Jonathon Jongsma 2008-12-23 18:04:57 UTC
notice:

73 	void spawn_async_with_pipes(const std::string& working_directory,
74 	const Glib::ArrayHandle<std::string>& argv,
75 	const Glib::ArrayHandle<std::string>& envp,
76 	SpawnFlags flags,
77 	const sigc::slot<void>& child_setup,
78 	Pid* child_pid,
79 	int* standard_input,
80 	int* standard_output,
81 	int* standard_error)
82 	{
83 	const bool setup_slot = !child_setup.empty();
84 	sigc::slot<void> child_setup_ = child_setup;
85 	GError* error = 0;
86 	
87 	g_spawn_async_with_pipes(
88 	working_directory.c_str(),
89 	const_cast<char**>(argv.data()),
90 	const_cast<char**>(envp.data()),
91 	static_cast<GSpawnFlags>(unsigned(flags)),
92 	(setup_slot) ? &child_setup_callback : 0,
93 	(setup_slot) ? &child_setup_ : 0,
94 	child_pid,
95 	standard_input, standard_output, standard_error,
96 	&error);
97 	
98 	if(error)
99 	Glib::Error::throw_exception(error);
100 	} 

If glibmm is build with exceptions disabled, the Glib::Error::throw_exception() function simply returns a std::auto_ptr<> with the error, but we dont' do anything with it, we just let it go out of scope at the end of the function.  So the user has no way of knowing that the function failed.
Comment 1 Murray Cumming 2008-12-24 22:11:24 UTC
Created attachment 125284 [details] [review]
spawn_no_exceptions.patch

Yes. I committed this patch to fix it. It's what we do for other functions/methods that throw exceptions.