Exception thrown in KHTMLPart::selection()

Leo Savernik l.savernik at aon.at
Wed Jan 19 20:13:08 GMT 2005


Am Mittwoch, 19. Januar 2005 20:51 schrieb John Tapsell:
> > Catch it.
>
> In particular the error I get when compiling with a try catch is:
>
> khtml_part.cpp: In member function `DOM::Range KHTMLPart::selection()
> const': khtml_part.cpp:3373: error: exception handling disabled, use
> -fexceptions to enable

Oops, my bad. Exception Handling is only enabled for the public DOM api.

Well, then use RangeImpl instead. It doesn't throw exceptions, but returns 
neat int &exceptioncode parameters instead:

RangeImpl *rng = new RangeImpl(xmlDocument());
rng->setStart(node, offset, exceptioncode);
rng->setEnd(node, offset, exceptioncode);

Don't use the convenience constructor, it doesn't do any range checking.

Return an empty range if you encounter an exception (is just a hack, but 
waaays better than a SIGSEGV).

mfg
 Leo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20050119/99c03fc8/attachment.sig>


More information about the kfm-devel mailing list