Author Topic: C::B corrupts project layout  (Read 5154 times)

Offline l_inc

  • Multiple posting newcomer
  • *
  • Posts: 56
C::B corrupts project layout
« on: October 29, 2015, 06:58:07 am »
Good day. I have the following problem. If there are many files open in a project and with some planets incorrectly aligned C::B corrupts the layout file while just opening and closing the project. This includes for instance modification of some values position and topLine for the cursor. I attached a sample project, where opening and closing the project in C::B four times leads to splitting the view, which is then impossible to get rid of.
I'm getting this with CodeBlocks 13.12.svn.10538 on Fedora 22.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2177
Re: C::B corrupts project layout
« Reply #1 on: October 29, 2015, 04:53:42 pm »
svn build  rev 10538 (2015-10-18 12:10:34)   gcc 4.9.2 Windows/unicode - 32 bit

I too have experienced this problem: the screen splits when loading an additional project into the workspace.
Deleting the "<EditorTabsLayout layout=" entry in the layout file solved the problem.

Offline l_inc

  • Multiple posting newcomer
  • *
  • Posts: 56
Re: C::B corrupts project layout
« Reply #2 on: October 29, 2015, 11:03:47 pm »
Pecan
Quote
the screen splits when loading an additional project into the workspace
The problem I reported is not related to loading additional projects. It's just enough to start and close the same project multiple times and the layout will gradually get corrupted eventually leading to the split view without any other projects involved.
Quote
Deleting the "<EditorTabsLayout layout=" entry in the layout file solved the problem.
It solves the problem of splitting for the next few loads of the project, and then the split will reappear. And it does not solve the problem of corrupting the other (even if those are minor) parameters of the layout.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5188
Re: C::B corrupts project layout
« Reply #3 on: October 29, 2015, 11:26:26 pm »
Today, I got this twice, never had it before (nearly latest trunk build)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9506
Re: C::B corrupts project layout
« Reply #4 on: October 30, 2015, 07:32:00 am »
Well that is interesting: Indeed, also on Windows if you open the provided project 3 times it starts splitting the editors... everytime after that another split gets introduced...

Well that is weird...

Lets see what the latest changes to the layout mechanism were...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9506
Re: C::B corrupts project layout
« Reply #5 on: October 30, 2015, 08:08:45 am »
One update: It seems related to the fact that the project file includes references to source files that are not present. Could you (guys) please verify if this also happens in case all files are really present? (You can use the "find broken files" plugin to clean-up the project).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12069
    • Travis build status
Re: C::B corrupts project layout
« Reply #6 on: October 30, 2015, 08:34:39 am »
Probably this is related to the changes done by Jens to support preserving the splits in the layout.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2177
Re: C::B corrupts project layout
« Reply #7 on: October 30, 2015, 05:22:02 pm »
No broken files were found by  "find broken files" on either of the two projects in the workspace.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: C::B corrupts project layout
« Reply #8 on: October 30, 2015, 11:35:37 pm »
My implementation below overcomes (not fixes) this problem when enabled. It might help till the problem is fixed.
http://sourceforge.net/p/codeblocks/tickets/182/

Offline l_inc

  • Multiple posting newcomer
  • *
  • Posts: 56
Re: C::B corrupts project layout
« Reply #9 on: October 31, 2015, 01:17:29 am »
MortenMacFly
Quote
One update: It seems related to the fact that the project file includes references to source files that are not present.
Yes, that seems correct. No layout attributes get modified when there are no missing project files.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: C::B corrupts project layout
« Reply #10 on: October 31, 2015, 09:08:58 am »
Probably this is related to the changes done by Jens to support preserving the splits in the layout.
If the EditorTabsLayout-part is broken, this might be.
But this should not not chage cursor-position or top-line.
I try to investigate, but I'm very busy at the moment.

I only get it, if  some source files are not present.
I mean the "autromatically" split (and break layout) when closing and reopening the project.

The fact that the tabs of two (or more) projects might get incorrectly merged or (at least in an unecpected way) is another thing.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: C::B corrupts project layout
« Reply #11 on: October 31, 2015, 05:40:13 pm »
Probably this is related to the changes done by Jens to support preserving the splits in the layout.
The issue with the example project of the OP should be fixed in trunk.
It was indeed, because of missing source-files,  with fileOpen-attribute-set in the layout file.
After some closing and opening, it ended with several fioles with the same tab-position.
And this seems to lead to a corruption in cbauibook::LoadPerspective().

I also changed the SavePerspective()-code in a way, that a project layout-file only saves the tab-layout of files belonging to the project, and that the tab-layout of files not belonging to any project is no longer saved.
Workspace-layout files should save the tab-layout of all files belonging to any project.

Offline l_inc

  • Multiple posting newcomer
  • *
  • Posts: 56
Re: C::B corrupts project layout
« Reply #12 on: November 02, 2015, 02:46:16 pm »
jens
Thank you. The layout attributes are not continuously changed anymore. But I'd like to note that these still are modified as long as EditorTabsLayout contains those missing files. It's currently not usability critical, because the missing files are thrown out of EditorTabsLayout once the project is opened, and the layout attributes (such as tabpos, position and topLine) get then stable values, but the new values are read from some unexpected memory locations. So the bug is worked around, but still seems to persist and could get in the way later, e.g. as a crash resulting from a read from unallocated memory.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: C::B corrupts project layout
« Reply #13 on: December 15, 2015, 12:14:24 am »
jens
Thank you. The layout attributes are not continuously changed anymore. But I'd like to note that these still are modified as long as EditorTabsLayout contains those missing files. It's currently not usability critical, because the missing files are thrown out of EditorTabsLayout once the project is opened, and the layout attributes (such as tabpos, position and topLine) get then stable values, but the new values are read from some unexpected memory locations. So the bug is worked around, but still seems to persist and could get in the way later, e.g. as a crash resulting from a read from unallocated memory.
Can you please be more specific and write where values from unallocated memory are read ?

Offline l_inc

  • Multiple posting newcomer
  • *
  • Posts: 56
Re: C::B corrupts project layout
« Reply #14 on: December 15, 2015, 12:24:38 am »
jens
I did not debug it, and reading from unallocated memory was my speculation about such possibility. The point is that the layout attributes a still changed, if the layout contains missing files for whatever reason (might be a common situation btw., e.g. when switching between multiple git branches). I have no idea where the changed values actually come from. Hence the speculation. But the bug is worked around, not fixed.