Re: Unhandled exception?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/27/2014 6:04 AM, Chris Vine wrote:
Two subsidiary thoughts: as an alternative have you tried setting
the encoding to CP437? iconv() supports it on my system so glib
ought to also.

Yes, calling set_encoding() fixed the exception, although iconv seems
to be translating the 0xBD character incorrectly.

That might work in this particular case if I know the input is CP-437,
but how should this conversion exception be handled in general?  I
tried catching and ignoring the exception, but read() leaves the bad
characters in the stream, so trying again just keeps throwing the same
exception.  How can you skip over the damn thing and move on?

Secondly, on the issue of exceptions, if you are reading the
IOChannel in a callback in the glib main loop I suspect glibmm is
swallowing the exception in order to protect the main loop,
although I haven't looked at glibmm's wrapper for executing
callbacks in the main loop for some time so I could be wrong.  It
is often better to swallow a throwing callback and print to
g_critical() than terminate the program, as you can use
g_log_set_always_fatal() to change the behaviour if you want.

If I am right about glibmm protecting the main loop, I would be 
surprised if by swallowing the exception, glibmm caused gparted's
call stack to unwind.  You would expect that to do the opposite
(and exceptions can't propagate through glib's C layer to unwind
the stack anyway), albeit as you say probably rendering the program
useless.

That is the bug I was referring to.  An unhandled exception is
supposed to be a fatal error, resulting in abort().  By catching and
ignoring the exception, glibmm is inviting all kinds of trouble.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJThKipAAoJEI5FoCIzSKrwbZgH/2h8odcdb7UEc79AaiIV9oCP
rzpOT/7+uq5WqWgF8zIkTKPa+Dok2vtv1H2XVK6jQBdnx6aS9+euHJnPkwjkEEiz
ZAxeXLbCtCTLUQoVZPKxydoanDwxOatuWU6DnpDmVctAY0T7MD9w4JK787wXVIGY
RUM6NqUVd6w7bQzw0gxcrb/CWyRcuiHIQkzyOVyu+7tqKEO5C8rEqRnXcxxH5n3d
Ajc+QYINAZi4K3kYfxMglm8DqV47op0Aq2oWhucnaqlFfvgURRxtMA7pbiqOJzz4
Af99aJtO8TPOGyV00lb/CVjdEbQZEbjz/yV6Tax3XToL6YRnpqiywzb53s4nbfE=
=ZBZq
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]