Bug 34763

Summary: class method modify bug (crash)
Product: [Applications] kdevelop Reporter: Dennis Noordsij <dennis.noordsij>
Component: kdevelop 2.x (obsolete)Assignee: KDevelop-Devel List <kdevelop-devel>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: 2.0.1   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Dennis Noordsij 2001-11-11 01:14:39 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kdevelop
Version:           2.0.1 (using KDE 2.2.1 )
Severity:          normal
Installed from:    Debian Package 4:2.2.1-14 (testing/unstable)
Compiler:          gcc version 2.95.4 20011006 (Debian prerelease)
OS:                Linux (i686) release 2.4.14
OS/Compiler notes: 

Hi

To reproduce:

When working on a project right click on a class in the treeview and add a member function. For example just a simple void Test();

Then after you realise you need to pass it parameters modify the include and source file to for example void Test(QString &mes);

Under certain (all?) circumstances in this case when a file got saved or the class treeview updated whilst in the middle of editing the source and include file are out of sync and the class view tree gets corrupted.

In better English :-) a situation can/will arise where in the class treeview there is both a "void Test()" and a "void Test(QString &mes)" re-making the project and saving files will not update this (though perhaps it would update it at a regular interval?)

When trying to delete the member function (the Test() one which doesn't actually exist in source and include anymore) KDevelop segfaults.

Basically there are 2 issues the first one is the synchronisation between tree view and actual files (which in itself does not have to be deadly) and the second one is that kdevelop should probably not crash if it can not find the member function it is trying to delete. Maybe if it encounters such a situation it could rescan the source/include files to rebuild the class view tree?

Otherwise magnificent program! Love it :-)

(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 Simon Blandford 2001-11-20 10:39:17 UTC
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)
Comment 2 Simon Blandford 2001-11-20 11:40:10 UTC
Futher to the bug report I have made a new discovery.

If I create a new class and make the Baseclass name the same as the Class
name I get a segfault on trying to change it's properties. If I call the
Baseclass something different it works OK.

Regards
Simon B.
Comment 3 Caleb Tennis 2003-01-01 04:15:48 UTC

*** This bug has been marked as a duplicate of 51531 ***