Bug#34763: segfault when modifying a class

simon.blandford at bss.co.uk simon.blandford at bss.co.uk
Tue Nov 20 10:39:17 UTC 2001


Version: 2.0.1 (using KDE 2.2.1 )
Installed from:    Mandrake Linux Vitamin
Compiler:          gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)
OS:                Linux (i686) release 2.4.8-26mdk
OS/Compiler notes: 

I have a project in which I just created a new class, added some include files and started coding the constructor but if I now try to right-click modify the class in the class editor in any way I get a segfault.

The difference from bug 34763 is that the .h and .cpp files have consistant definitions.

Here is the .h file excluding comments...

#ifndef SOCKETCON_H
#define SOCKETCON_H

#include <socketcon.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

/**This is for talking to the Parallel Port drive.
  *@author Simon Blandford
  */

class SocketCon : public SocketCon  {
public: 
 SocketCon();
 ~SocketCon();
};

#endif



...and here is the corresponding .cpp file...

#include "socketcon.h"

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

//int         sockfd;
//int         len;
//sockaddr_un address;

SocketCon::SocketCon(){
  if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
 {
   perror("Unable to open socket.");
  exit(1);
 }

  address.sun_family = AF_UNIX;
  strcpy(address.sun_path, "/tmp/par_port");
  len = sizeof(address);

  if ((connect(sockfd, (sockaddr*)&address, len)) < 0)
  {
  perror("Unable to connect to pport driver.");
  exit(1);
  }
}
SocketCon::~SocketCon(){
 close(sockfd);
}


It looks a bit crude because it is under construction and I am quite new to c++ ;-)

I have zipped up the whole project (~450Kb) if anyone needs it.

(Submitted via bugs.kde.org)
(Called from KBugReport dialog)


-
to unsubscribe from this list send an email to kdevelop-devel-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop-devel mailing list