Author Topic: C::B crash (Settings-->Editor)  (Read 55746 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #45 on: April 20, 2006, 08:00:47 pm »
I am getting really bad results attempting to shoot this constructor
bug inside CodeStats plugin. The compiler is not constructing Languages_Def class correctly. It's calling the wxArrayString to construct the "name" wxString.

And... when I add a constructor to Languages_Def class, it's never
invoked under linux. But the same code executes correctly under windows.

My ubuntu 510 is using:
gcc version 4.0.2 20050808 (prerelease ) (Ubuntu 4.0.1-4 ubuntu9)

Questions:
Are all Linux users getting the Codestat crash, or just Ubuntu users?
What gcc compiler version are *non-crash* Linux users using?
Is there another gcc for Ubuntu that I can test with?

thanks
pecan

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: C::B crash (Settings-->Editor)
« Reply #46 on: April 20, 2006, 08:07:53 pm »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #47 on: April 20, 2006, 08:12:42 pm »
There's GCC 3.4.3: http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/

Is there an "apt-get" type command to install this?

thanks
pecan

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: C::B crash (Settings-->Editor)
« Reply #48 on: April 20, 2006, 08:26:48 pm »
There's GCC 3.4.3: http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/

Is there an "apt-get" type command to install this?

I would use Synaptic Package Manager instead :). Anyway, I am not sure that it is a compiler issue. My colleague on Kubuntu 5.10, running the .deb compiled by me, has not Setting-->Editor crash (and I have tried several times).

May be the problems is related or to some packages I have installed and that make conflicts. The wxGTK libraries that I use are the same as him (anway, I will ask him just to be sure).

Best wishes,
Michael

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #49 on: April 20, 2006, 08:30:28 pm »
There is a module in sdk/Projectfileoptionsdlg.cpp that
is being used as the constructor for LanguagesDef under
ubuntu gcc 4.0.2

Code
#include "projectfileoptionsdlg.h"
#include <wx/slider.h>
#include <wx/textfile.h>

BEGIN_EVENT_TABLE(ProjectFileOptionsDlg, wxDialog)
EVT_CHOICE(-1, ProjectFileOptionsDlg::OnCompilerCombo)
EVT_UPDATE_UI(-1, ProjectFileOptionsDlg::OnUpdateUI)
END_EVENT_TABLE()

// some help functions and type (copied and adapted from the codestat plug-in)
struct LanguageDef
{
wxArrayString ext;
wxString single_line_comment;
wxString multiple_line_comment[2];
};


What is this all about. NOTE: the "wxString name" declaration
is missing.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: C::B crash (Settings-->Editor)
« Reply #50 on: April 20, 2006, 08:34:38 pm »
Maybe apt-get install gcc-3.4 g++-3.4?

Beware it allows different versions to coexist and gcc, g++ and friends could be all symlinked to 4.0.

When going to compile Code::Blocks, force it to use gcc-3.4 and g++-3.4: CXX=g++-3.4 CC=gcc-3.4 CPP=cpp-3.4 ./configure (haven't tried though).

Zlika

  • Guest
Re: C::B crash (Settings-->Editor)
« Reply #51 on: April 20, 2006, 09:12:25 pm »
There is a module in sdk/Projectfileoptionsdlg.cpp that
is being used as the constructor for LanguagesDef under
ubuntu gcc 4.0.2
What is this all about. NOTE: the "wxString name" declaration
is missing.

Yiannis took some functions of codestat to compute the number of comment/code lines for a particular file and display it in the "properties" menu of the selected file.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B crash (Settings-->Editor)
« Reply #52 on: April 20, 2006, 09:19:53 pm »
Ok, Yiannis can have it.

I've change CodeStats LanguageDef symbol to csLanguageDef
and the crash has gone away. The correct constructor is being called.
This still looks like a compiler err though.

EDIT:: Not a compiler err I'm thinking. Projectfileoptionsdlg.h is not being included
by CodeStat. LanguageDef is a structure in a .cpp and the other a
Class in CodeStats. How can it be being treated like a hidden constructor?.
But it IS....

Now... CodeStat still crashes on Linux at a new location.

It fails loading its resources in CodeStatConfigDlg::ReInitDialog(). And... it doesn't check to see if it failed, so it uses 0x0 as its txt_FileTypes address getting a SIGSEGV for its efforts.

Did this thing ever work on Linux?

I'm tired....
« Last Edit: April 20, 2006, 11:17:21 pm by Pecan »

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
[solved] C::B crash (Settings-->Editor)
« Reply #53 on: April 20, 2006, 09:21:11 pm »
Hello,

I think Pecan has solved the crash :D. I still have to test more in depth, but I got no more Settings-->Editors crash with codestats plugin :D. Moreover, codestats plugin works too without a crash :D.

To "solve" the problem, just:

Quote
// some help functions and type (copied and adapted from the codestat plug-in)
struct LanguageDef
{
   wxString name; <-- Add this!
        wxArrayString ext;
   wxString single_line_comment;
   wxString multiple_line_comment[2];
};

Pecan, you save my day :). If you decide to visit Austria and/or Switzerland (Eventually Thailand too :)), let me know and I will pay at least a dinner :D.

Best wishes,
Michael

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: C::B crash (Settings-->Editor)
« Reply #54 on: April 20, 2006, 09:22:23 pm »
Yiannis took some functions of codestat to compute the number of comment/code lines for a particular file and display it in the "properties" menu of the selected file.

No, it was not Yiannis. It was Lieven, IIRC...
Be patient!
This bug will be fixed soon...

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: [solved] C::B crash (Settings-->Editor)
« Reply #55 on: April 20, 2006, 09:33:35 pm »
Hello,

I think Pecan has solved the crash :D. I still have to test more in depth, but I got no more Settings-->Editors crash with codestats plugin :D. Moreover, codestats plugin works too without a crash :D.

To "solve" the problem, just:

Quote
// some help functions and type (copied and adapted from the codestat plug-in)
struct LanguageDef
{
   wxString name; <-- Add this!
        wxArrayString ext;
   wxString single_line_comment;
   wxString multiple_line_comment[2];
};

Pecan, you save my day :). If you decide to visit Austria and/or Switzerland (Eventually Thailand too :)), let me know and I will pay at least a dinner :D.

Best wishes,
Michael


I don't think you want to do that!! That structure is being
treated as the default "constructor" for LanguageDef.
Change the name of LanguageDef to something like csLanguageDef
and define a constructor and destructor like:
Code
#include "language_def.h"
csLanguageDef::csLanguageDef()
{
    name = wxEmptyString;
    ext.clear();
    single_line_comment = wxEmptyString;
    multiple_line_comment[0] = wxEmptyString;
    multiple_line_comment[1] = wxEmptyString;
}
csLanguageDef::~csLanguageDef()
{;}

This is going to happen again if you dont get away from that
structure....

thanks
pecan



Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: [solved] C::B crash (Settings-->Editor)
« Reply #56 on: April 20, 2006, 11:42:51 pm »
I don't think you want to do that!! That structure is being
treated as the default "constructor" for LanguageDef.
Change the name of LanguageDef to something like csLanguageDef
and define a constructor and destructor like:
Code
#include "language_def.h"
csLanguageDef::csLanguageDef()
{
    name = wxEmptyString;
    ext.clear();
    single_line_comment = wxEmptyString;
    multiple_line_comment[0] = wxEmptyString;
    multiple_line_comment[1] = wxEmptyString;
}
csLanguageDef::~csLanguageDef()
{;}

This is going to happen again if you dont get away from that
structure....

Ok. So, I have taken out the the wxString name from the structure and changed the name of the class LanguageDef (in Code Statistics project-->language_def.h) in CsLanguageDef and its instances in cslanguages/cslanguage (in Code Statistics project).

This seems to work too. I got no crashes until now :D.

Anyway, it seems that the codestats plugin now return that the project is empty, even if it is not :?.

Best wishes,
Michael

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: [solved] C::B crash (Settings-->Editor)
« Reply #57 on: April 20, 2006, 11:51:58 pm »
Anyway, it seems that the codestats plugin now return that the project is empty, even if it is not :?.

Ok, it makes sense that some quirks would occur now that
the code is changed. But it's much safer this way.

If you'd like me to test/trace through some of these problems,
you could zip up your code and attach it. I'll help if you'd like...

Also, How do you execute the plugin? Does it have a menu item?
I've never used it since the configuration structure changed some
months ago,

EDIT: found the menu item...

thanks
pecan
« Last Edit: April 21, 2006, 12:06:15 am by Pecan »

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: [solved] C::B crash (Settings-->Editor)
« Reply #58 on: April 21, 2006, 12:06:28 am »
Anyway, it seems that the codestats plugin now return that the project is empty, even if it is not :?.

Ok, it makes sense that some quirks would occur now that
the code is changed. But it's much safer this way.

If you'd like me to test/trace through some of these problems,
you could zip up your code and attach it. I'll help if you'd like...

I have just changed the class name and the name of all its instances within the Code Statistics project. Theoretically it should works, but may be there is a dependency with the structure in the sdk. Would have to check.

I have compressed the codestats plugin and put in my File Hosting system. You can get it from here.

Thank you very much for your help :).

Also, How do you execute the plugin? Does it have a menu item?
I've never used it since the configuration structure changed some
months ago,

To execute the plugin, just open a project and then Plugins-->Code Statistics (be sure to have it selected under Plugins-->Manage plugins).

Best wishes,
Michael
« Last Edit: April 21, 2006, 04:17:43 pm by Michael »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: C::B crash (Settings-->Editor)
« Reply #59 on: April 21, 2006, 07:52:54 am »
I have borrowed some code and functions from the codestats, to provide some statistics in the properties panel of a projectfile.
Though the functions are at global scope; so different name then the plug-in, but it seems (have to check code, will do that in 2 hours) the structure has the same name. Maybe the linker/???/??? get's confused>. Though both definitions are in different dll's; so only when both dll's are loaded we (could) have twice the definition.

If there's a name clash, I don't think the plug-in should change, the "borrower" should change, that's only fair. Although I might have an idea on how to plug-in can protect itself against those "code stealers" ;-)

More on this later, should reread tha last topics and look at the code fore some better analysis.

Will be back soon ...