[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Segmentation fault when using exception handling and ttystream
From: |
a2574 |
Subject: |
Segmentation fault when using exception handling and ttystream |
Date: |
Thu, 5 Dec 2002 12:04:33 GMT |
User-agent: |
IMP/PHP3 Imap webMail Program 2.0.11 |
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.
- Segmentation fault when using exception handling and ttystream,
a2574 <=