Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: danselmi on October 27, 2010, 02:38:36 pm

Title: Crash after opening an XPM file.
Post by: danselmi on October 27, 2010, 02:38:36 pm
Codeblock crashes when I open an XPM file. If I uninstall code completion plugin, I am able to open the xpm within codeblocks without problems.

CB r6770,
WinXP SP3,
mingw-tdm-5.4.1
wx2.8.11

Has anybody this problem too?

Title: Re: Crash after opening an XPM file.
Post by: Loaden on October 27, 2010, 03:00:45 pm
Could you post the XPM file in here?
Title: Re: Crash after opening an XPM file.
Post by: jens on October 27, 2010, 03:03:30 pm
Could you post the XPM file in here?
It does not crash here with 6771 (linux and winxp), but it is also not parsed.
The veraiable name included should be in global variables I think.
Searching for it in the symbols-browser gives no result.
Title: Re: Crash after opening an XPM file.
Post by: Loaden on October 27, 2010, 03:36:57 pm
Could you post the XPM file in here?
It does not crash here with 6771 (linux and winxp), but it is also not parsed.
The veraiable name included should be in global variables I think.
Searching for it in the symbols-browser gives no result.
Yes, It should not parsed, because only need parsing for C/C++ files.
 :D
Title: Re: Crash after opening an XPM file.
Post by: jens on October 27, 2010, 03:46:36 pm
An xpm-file is defacto a very simple c-headerfile including the declaration of a static variable, that can be included and used as all other headers.
So I think it should also be parsed (at least if it's not xpm2 or xpm3).
http://en.wikipedia.org/wiki/X_PixMap (http://en.wikipedia.org/wiki/X_PixMap)
Title: Re: Crash after opening an XPM file.
Post by: danselmi on October 27, 2010, 07:47:39 pm
Updated to r6771, still crashes after opening an xpm file.
I attached a XPM file and the call-stack (gdb 7.2) from the crash.
Title: Re: Crash after opening an XPM file.
Post by: danselmi on October 27, 2010, 09:20:02 pm
So it must not be a xpm! A simple txt will do to give a crash if the file does not belong to a project. (Jens, the xpm you tried is from an open project, right?) The following patch stops cb crashing:
Code
Index: nativeparser.cpp
===================================================================
--- nativeparser.cpp (revision 6773)
+++ nativeparser.cpp (working copy)
@@ -3368,7 +3368,7 @@
         SwitchParser(project, parser);
     }
 
-    if (m_ClassBrowser && parser->ClassBrowserOptions().displayFilter == bdfFile)
+    if (m_ClassBrowser && parser && parser->ClassBrowserOptions().displayFilter == bdfFile)
     {
         // check header and implementation file swap, if yes, don't need to rebuild browser tree
         m_ClassBrowser->UpdateView(true);
Don't know if it is the right way!

The other thing is that: IMHO an xpm should be parsed.
Title: Re: Crash after opening an XPM file.
Post by: jens on October 27, 2010, 09:27:27 pm
Yes it was in a project.
It crashes witha a single xpm or with another file, that is not a source or header-file, sources or headers are parsed correctly.
Title: Re: Crash after opening an XPM file.
Post by: MortenMacFly on October 27, 2010, 09:37:01 pm
The other thing is that: IMHO an xpm should be parsed.
Isn't that the case if you put the XPM extension under C/C++ source files?
Title: Re: Crash after opening an XPM file.
Post by: danselmi on October 27, 2010, 10:21:33 pm
The other thing is that: IMHO an xpm should be parsed.
Isn't that the case if you put the XPM extension under C/C++ source files?
I just tried: xpms are highlighted now, but CC doesn't know the name (xy_xpm) of the string.
Title: Re: Crash after opening an XPM file.
Post by: Loaden on October 28, 2010, 02:08:20 am
Fixed, thank guys!  :D