When I start C::B with "sudo codeblocks" in the console, I get the following output:
Error: Unable to initialize gtk, is DISPLAY set properly?
(I use OpenSuse with KDE-Desktop)
That's normal behaviour, it's not allowed to access your display, even not for root.
That's by design and has nothing to do with C::B !
If you type
before
sudo codeblocks
it should work also.
You should forbid display access with
after closing C::B for security reasons, even if it is not a real problem on a single user system (In most cases).
But when I start a root shell and then type "codeblocks" to start C::B, it starts correctly (without the error above), I can change any settings and they were really saved. When I then close C::B (with the code completion plugin enabled or not), the process is terminated correctly.
It's a strange behaviour of C::B...
I think it's a strange behaviour of you system, not C:::B.
The output shows nothing real serious, even the GTK-Critcals are normally harmless, they come from a wxWidgets bug, and that's not a C::B issue, as we do not maintain wxWidgets. In most cases it's done by a maintainer-team of the distro you use.
That does not mean, that we do not try to work around such issues, but it's sometimes not easy.
And we have issues and bugs in our sources also, of course.
That's normal for complex software, and we can not avoid it, sorry.
Nevertheless, did you try to remove (or better rename) the whole (hidden)
.codeblocks folder in your home-directory, when no instance of C::B is running.
Starting C::B should create it from scratch with default values, all your user settings will be lost, but you can restore some of them with
cb_share_config.