Dear Gordon and All,
Thanks for your kind advice. I debugged it using Rhide, and when it gets
through the Destructor part, it gives error message: "Segmentation fault",
then says " Could not find the source file memcpy.c". I am puzzled with
this, what's the matter with "memcpy.c" ?
Another very strange phenomenon is that, I put a QMessageBox in the
Destructor in order to check if Destructor really run, but I found that the
Destructor doesn't run when I close the class, strangely, the QMessageBox
appears when I open the class for the second time. What's wrong with this
???
Moreover, in my codes, I didn't use anything related with QGArray, I just
Open/Close the real time FIFO under RT Linux, so, how could I debug into
the QGArray errors ??
Thanks a lot for your any kind suggestion and hints, sigh ;-( , I have been
blocked here for several days.
Kind regards,
Yuhong
----- Original Message -----
From: Gordon McNutt <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, December 30, 2000 4:46 AM
Subject: Re: [rtl] Qt & RT Linux -->Segmentation fault (core dumped)
> Ren Yuhong wrote:
>
> > Dear All,
> >
> > I am combining Qt & RT Linux to develpe a simple motor controller. I use
> > Qt to design a GUI, since I need to use RT FIFO for communication
> > between Qt's GUI and the real time kernel module, I need to handle the
> > RT FIFO within GUI, following is my codes:
> >
> > ---------------------------------------------
> > /********************
> > Constructor
> > NB: "TEST" is a dialog
> > *********************/
> > TestImpl::TestImpl( QWidget* parent,const char* name, bool modal, WFlags
> > f) : TEST( parent, name, modal,f)
> > {
> >
> > // Try to connect with RT task via FIFO
> > fd1 = open("/dev/rtf1", O_RDWR);
> > if ( fd1 == -1 )
> > {
> > printf("Can not open /dev/rtf1\n");
> > close(fd1);
> > file://return -1;
> > }
> >
> > fd2 = open("/dev/rtf2", O_RDWR); file://RDWR
> > if ( fd2 == -1 )
> > {
> > printf("Can not open /dev/rtf2\n");
> > close(fd2);
> > file://return -1;
> > }
> > }
> >
> > ------------------------------------------------
> > /***********
> > Destructor
> > ***********/
> > TestImpl:: ~TestImpl()
> > {
> > close(fd1);
> > close(fd2);
> > }
> > -----------------------------------------------
> >
> > With the above constructor and destructor, it is Ok to open the dialog
> > class only ONCE within my GUI. If I open it for the second time, the
> > error message comes out as follows:
> > --------------
> > QGArray: Cannot allocate array with negative length
> > Segmentation fault (core dumped)
> > --------------
> >
> > I am wondering if the RT FIFOs have really been closed or not. I used
> > RHIDE to debug it, and found that the codes went through "close(fd1);
> > close(fd2);".
> >
>
> Why do you suspect the FIFO's when you're error message is complaining
> about QGArray code? Have you tried gdb to see where the seg fault occurs?
>
> --Gordon
>
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ---
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/
>
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/