Bug 267124 - formatter settings crash on invalid mimetypes in .desktop file
Summary: formatter settings crash on invalid mimetypes in .desktop file
Alias: None
Product: kdevelop
Classification: Unclassified
Component: Astyle (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: VHI major with 40 votes (vote)
Target Milestone: 4.2.0
Assignee: kdevelop-bugs-null
Depends on:
Reported: 2011-02-25 07:41 UTC by Steffen Ohrendorf
Modified: 2011-04-11 23:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:

backtrace (25.80 KB, text/plain)
2011-04-10 19:29 UTC, Steffen Ohrendorf
valgrind output (8.59 KB, text/plain)
2011-04-10 23:22 UTC, Steffen Ohrendorf
output of ktraderclient for ISourceFormatter (3.89 KB, text/plain)
2011-04-11 13:46 UTC, Steffen Ohrendorf

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Ohrendorf 2011-02-25 07:41:10 UTC
Version:           git master (using KDE 4.6.0) 
OS:                Linux

When using the internal AStyle formatter, the content of a struct typedef gets deleted.
struct Foo { ... };
typedef struct { ... } Foo;

Reproducible: Always

Steps to Reproduce:
Write some C++ code, create a struct typedef, reformat source.

Actual Results:  
Struct content deleted.

Expected Results:  
Struct content should be formatted.
Comment 1 Milian Wolff 2011-02-28 11:53:48 UTC
will have to investigate later...
Comment 2 Milian Wolff 2011-04-10 00:55:24 UTC
cannot reproduce - what are your exact astyle settings?
Comment 3 Steffen Ohrendorf 2011-04-10 02:11:45 UTC
Bugzilla scheint im Moment Probleme zu haben, ich kann weder 
kommentieren noch Attachments hinzufügen.

Ich kriege einen SIGSEGV wenn ich versuche die Einstellungen vom 
Formatter aufzurufen, evtl. ist es ein upstream Bug.
Qt: 4.7.1
KDE: 4.6.00 (4.6.0) "release 6"
kde4-config: 1.0

MfG, Syron
Comment 4 Milian Wolff 2011-04-10 17:21:58 UTC
give us a backtrace, make sure you have up2date kdevplatform + kdevelop
Comment 5 Steffen Ohrendorf 2011-04-10 19:29:50 UTC
Created attachment 58776 [details]
Comment 6 Milian Wolff 2011-04-10 22:37:43 UTC
that is supposed to be fixed - please make sure you have up2date kdevplatform + kdevelop installed. also check output of "git remote -v" and verify it's pointing to git.kde.org and not still gitorious.

if you can still rreproduce it, please valgrind it.
Comment 7 Steffen Ohrendorf 2011-04-10 23:22:58 UTC
Created attachment 58783 [details]
valgrind output
Comment 8 Steffen Ohrendorf 2011-04-10 23:26:20 UTC
All git remotes are pointing to anongit.kde.org, master is at HEAD, distribution (openSuSE 11.4) is up-to-date.
Comment 9 Milian Wolff 2011-04-11 13:25:20 UTC
please output the contents of running this command in a konsole:

ktraderclient --servicetype KDevelop/Plugin --constraint "'org.kdevelop.ISourceFormatter' in [X-KDevelop-Interfaces]"
Comment 10 Steffen Ohrendorf 2011-04-11 13:46:24 UTC
Created attachment 58797 [details]
output of ktraderclient for ISourceFormatter
Comment 11 Milian Wolff 2011-04-11 15:23:52 UTC
verified I'll fix it in quanta, Dmitry has a patch to prevent this issue in kdevplatform
Comment 12 Dmitry 2011-04-11 21:54:49 UTC
Git commit dc8638034d70052776027e7a34d7caedfd3d1881 by Dmitry Risenberg.
Committed on 11/04/2011 at 14:09.
Pushed by risenberg into branch 'master'.

Check KMimeType::mimeType result for null.

The result is null if the argument represents an unknown mimetype.
CCBUG: 267124

M  +4    -0    shell/settings/sourceformattersettings.cpp     

Comment 13 Steffen Ohrendorf 2011-04-11 22:07:14 UTC
Still removes the struct's contents, though the crash disappeared.
Astyle settings for C++ (not listed entries are unchecked):
- Tabs (4)
- Indent: Class, Labels, Namespaces, Preprocessor directives, Switches
- Maximum in statement: 40
- Minimum in conditional: Twice current
- Type: Attach, break closing headers
- Pad parentheses: Inside only
- Add spaces around operators
- Pointer alignment: Name
Comment 14 Dmitry 2011-04-11 23:55:13 UTC
Git commit 78c341bae38f85f79ff1906d0081b3d905107fb1 by Dmitry Risenberg.
Committed on 11/04/2011 at 23:59.
Pushed by risenberg into branch 'master'.

Fix peeking in astyle string iterator.

BUG: 267124

M  +4    -2    formatters/astyle/lib/astyle_stringiterator.cpp