[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Segmentation fault when using exception handling and ttystream
From: |
David Sugar |
Subject: |
Re: Segmentation fault when using exception handling and ttystream |
Date: |
Thu, 5 Dec 2002 16:55:03 -0500 |
User-agent: |
KMail/1.4.3 |
Generally a catch handler should catch this, but there have been changes in
the abi which may make self thrown objects have strange behavior. I would
suggest trying setException(Thread::throwException);
On Thursday 05 December 2002 07:04, address@hidden wrote:
> Hello!
>
> Fisrt of all, Im not an advanced C++ programmer... not even close. So
> maybe the answer is just in front of me but I havent see it yet.
>
> Im using commoncpp2-1.0.7. I use the serial interface for connecting to
> a device (a Laser). The problem is that when I use it without exception
> handling everything goes right, but if I switch it on
> (this->setError(true)) it makes a segmentation fault when an error
> occurs. I traced the code and apparently (or so the debugger says) the
> error is when the method Serial::error throws the object (itself)
>
> throw((Serial*)this)
>
> My code is this: (I inerhit from ttystream)
>
> class SerialInterface: public ost::ttystream{
> public:
> SerialInterface(const char *device);
> }
>
> // and implementation is:
>
> SerialInterface::SerialInterface(const char *device){
> this->setError(true);
> try{
> open(device); // The method for openning the device
> // I call it with a wrong argument \"/dev/jdss\"
> }catch (...){ // I have tried also (Serial *e) and so on ;(
> std::cout:: << getErrorNumber();
> }
> }
>
>
> Well, Is been two days now and Im starting to fed up... Two days and no
> code written, thats not what I call productivity.. he.
>
> Hoping you could help me...
>
> PS: By the way... to install was a nightmare (as well hehe), the debian
> package does not seem to work (but I guess it does not correspond to any
> of you) and /usr/include/time.h conflicts with
> /usr/include/cc++/cc+2/config.h its definition of nanosleep does not
> throw any exception, so I changed it, but I guess this is not the
> reason....
>
> By again.
>
> Jose.
>
>
>
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp