Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: koso on December 16, 2009, 10:40:03 am

Title: CodeCompletion r5979 problems
Post by: koso on December 16, 2009, 10:40:03 am
I have some strange problems with latest CC .. this is my test code:

Code
void getBase(int n) {
}

int main() {
    return 0;
}
On first project startup is everything as expected .. but after first change with save, list of global function symbols is updated, and it shows two symbols with names "e(" and "n(". Type of the first (from debug tool) is "v o i d g e t B a s". Also sometimes when i add somewhere space, after save, there are no symbols at all ...

The only solution I found is to delete .layout file for project and restart C::B, but next save, ant it is again broken ... anyone with the same problems?
Title: Re: CodeCompletion r5979 problems
Post by: blueshake on December 16, 2009, 11:17:56 am
@koso
Does it work withou save??????
Title: Re: CodeCompletion r5979 problems
Post by: blueshake on December 16, 2009, 11:22:56 am
I download the svn 5979 and confirm it ,but in my local copy it work well.seems something is wrong.
Title: Re: CodeCompletion r5979 problems
Post by: blueshake on December 16, 2009, 11:26:43 am
haha,get the reason.
patch:
Code
Index: src/include/filemanager.h
===================================================================
--- src/include/filemanager.h (revision 5979)
+++ src/include/filemanager.h (working copy)
@@ -144,7 +144,19 @@
     NullLoader(const wxString& name, char* buffer, size_t size) { fileName = name; data = buffer; len = size; Ready(); };
     void operator()(){};
 };
-
+class EditorReuser : public LoaderBase
+{
+public:
+    EditorReuser(const wxString& name, const wxString& s)
+    {
+        fileName = name;
+        len = strlen(s.mb_str(wxConvUTF8));
+        data = new char[len + 1];
+        strcpy(data, (const char*)s.mb_str(wxConvUTF8));
+        Ready();
+    }
+    void operator()(){};
+};
 // ***** class: FileManager *****
 class FileManager : public Mgr<FileManager>
 {
Index: src/sdk/filemanager.cpp
===================================================================
--- src/sdk/filemanager.cpp (revision 5979)
+++ src/sdk/filemanager.cpp (working copy)
@@ -138,12 +138,8 @@
                 cbEditor* ed = em->GetBuiltinEditor(em->GetEditor(i));
                 if(ed && fileName == ed->GetFilename())
                 {
-                    wxString s(ed->GetControl()->GetText());
-                    #if wxCHECK_VERSION(2, 9, 0)
-                    NullLoader *nl = new NullLoader(file, (char*) s.wx_str(), s.length() * sizeof(wxChar));
-                    #else
-                    NullLoader *nl = new NullLoader(file, (char*) s.c_str(), s.length() * sizeof(wxChar));
-                    #endif
+
+                    EditorReuser *nl = new EditorReuser(file, ed->GetControl()->GetText());
                     return nl;
                 }
             }
Title: Re: CodeCompletion r5979 problems
Post by: MortenMacFly on December 16, 2009, 11:28:32 am
haha,get the reason.
Dammed. My fault. Actually this slipped in when I committed ollydbg's patch. I'll fix this in SVN asap...
Title: Re: CodeCompletion r5979 problems
Post by: koso on December 16, 2009, 11:30:15 am
This is how i can reproduce it

1. create c++ console project with test code
2. open main.cpp, symbol browser and code completion works as expected
3. close project (this should generate layout file)
4. start project again = now symbols list is broken ..

so it is broken even without any save ...  

btw. platform is WinXP 32 bit.

EDIT: thansk for fix, you made path faster than I replied :D
Title: Re: CodeCompletion r5979 problems
Post by: MortenMacFly on December 16, 2009, 11:38:18 am
I'll fix this in SVN asap...
Done. Thanks for the report.
Title: Re: CodeCompletion r5979 problems
Post by: Jenna on December 16, 2009, 11:44:47 am
I'll fix this in SVN asap....
Done. Thanks for the report.

I just wanted to do the same, because on my system it leads to a crash in NullLoader dtor (debian 64-bit).
Not so hard to find because of a (more or less) meaningful backtrace and the NullLoader-discussion, but I was not fast enough with commiting.
Title: Re: CodeCompletion r5979 problems
Post by: MortenMacFly on December 16, 2009, 11:49:12 am
but I was not fast enough with commiting.
So in other words you are lame today. :lol: :lol: :lol:
Title: Re: CodeCompletion r5979 problems
Post by: Jenna on December 16, 2009, 11:54:10 am
but I was not fast enough with commiting.
So in other words you are lame today. :lol: :lol: :lol:

Not only today  :) ,

but in fact I'm at work, and should do anything with C::B at the moment, but I saw this thread and just wanted to test it and ...
Title: Re: CodeCompletion r5979 problems
Post by: killerbot on December 16, 2009, 02:37:33 pm
I indeed also had crashes when whatever project was loaded.

No just update, but make or make clean now gives the following error :

Code
rm: cannot remove `.libs/tinystr.o': Permission denied
rm: cannot remove `.libs/tinystr.o': Permission denied
 g++ -DHAVE_CONFIG_H -I. -I../../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../../src/include/wxscintilla/include -I../../../src/include -I../../../src/include/tinyxml -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT tinystr.lo -MD -MP -MF .deps/tinystr.Tpo -c tinystr.cpp  -fPIC -DPIC -o .libs/tinystr.o
Assembler messages:
Fatal error: can't create .libs/tinystr.o: Permission denied
make[3]: *** [tinystr.lo] Error 1
make[3]: Leaving directory `/home/lieven/Projects/Codeblocks/trunk/src/base/tinyxml'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/lieven/Projects/Codeblocks/trunk/src/base'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lieven/Projects/Codeblocks/trunk/src'
make: *** [all-recursive] Error 1
Title: Re: CodeCompletion r5979 problems
Post by: Jenna on December 16, 2009, 03:16:31 pm
I indeed also had crashes when whatever project was loaded.

No just update, but make or make clean now gives the following error :

Code
rm: cannot remove `.libs/tinystr.o': Permission denied
rm: cannot remove `.libs/tinystr.o': Permission denied
 g++ -DHAVE_CONFIG_H -I. -I../../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../../src/include/wxscintilla/include -I../../../src/include -I../../../src/include/tinyxml -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT tinystr.lo -MD -MP -MF .deps/tinystr.Tpo -c tinystr.cpp  -fPIC -DPIC -o .libs/tinystr.o
Assembler messages:
Fatal error: can't create .libs/tinystr.o: Permission denied
make[3]: *** [tinystr.lo] Error 1
make[3]: Leaving directory `/home/lieven/Projects/Codeblocks/trunk/src/base/tinyxml'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/lieven/Projects/Codeblocks/trunk/src/base'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lieven/Projects/Codeblocks/trunk/src'
make: *** [all-recursive] Error 1

No problems here.

Did you accidently run a make or make install as root or via sudo.
For make install you need to be root if you do not install in your home-directory, of course, but if the sources have not been build before running make install, make is called automatically as root, what leads to the exact same error as you have.
Title: Re: CodeCompletion r5979 problems
Post by: killerbot on December 16, 2009, 07:15:23 pm
yep, something like that must have happened, sudo make clean, and then again regular make and sudo make install fixed it.