Author Topic: Code editor window closing after saving files (related to very large projects)  (Read 6372 times)

Offline Stratelier

  • Single posting newcomer
  • *
  • Posts: 5
I'm trying this IDE for the first time (latest version, 25.03), but already I've hit a major problem: every time I save any code file I'm working on, the save is successful but then the editor window closes itself.  Not just the tab for the file saved, but the entire code editor window (all tabs) -- see attachment for an example.

Is this adjustable?  I've sifted through the settings once and didn't find anything obviously relevant.  I also (temporarily) disabled ALL of the extensions, which confirmed only that it isn't extension related (the underlying issue still happens).

Sure, it is technically a "minor" issue but this is such an obvious UX breaker I simply can not negotiate.  If it's a bug then fine, but in the meantime I am already continuing my search for a (different) code editor.
« Last Edit: Today at 04:43:52 am by Stratelier »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1858
Re: Why does the code editor window close after saving a file?
« Reply #1 on: April 17, 2026, 09:25:55 am »
This issue has not been reported elsewhere before, and it is very strange. May the destination folder (or file) be write-protected?

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2931
Re: Why does the code editor window close after saving a file?
« Reply #2 on: April 17, 2026, 07:25:46 pm »
You have only one file open. If the only file open is closed, that's what happens. The tab notebook closes also. So it looks like something has overridden the save function with a close function instead.
Codeblocks saves modified files if they are closed. But it usually asks first to do so.

I agree that this is entirely peculiar, never reported before, and I can't re-create it.
Are you saving the file with the drop down menu, or using a key combo?
Have there been any modification/overrides made to the keyboard?

Show us an image where you have two files open, then modify/save just one of them. What does that look like?
« Last Edit: April 17, 2026, 07:31:08 pm by Pecan »

Offline Stratelier

  • Single posting newcomer
  • *
  • Posts: 5
Re: Why does the code editor window close after saving a file?
« Reply #3 on: Yesterday at 01:34:14 am »
This issue has not been reported elsewhere before, and it is very strange. May the destination folder (or file) be write-protected?

The file is definitely not write-protected, since I am successful in saving it (though the editor window closes after saving).

Apparently the folder is marked as read-only (I had little incentive to even check for this going in) -- though removing the lock makes no difference, the editor window still closes after a successful save.

If I have multiple files open in the editor, make changes to only one file and save it (either from the menu or with the keyboard shortcut, the effect is the same), the editor window ultimately closes in its entirety.

If I have multiple files open in the editor, make changes to two or more files, then Save one of the files, the save is successful, but the file is closed after saving, and then CB prompts me to save the other file -- implying something is clearly trying to close the entire editor window after the successful save.  If I cancel at this point, the interface is left as-is, minus the tab for the file that was just saved.

Quote
Are you saving the file with the drop down menu, or using a key combo?
Have there been any modification/overrides made to the keyboard?
I get the same result either way -- save is successful, then the editor window closes. 

One important detail is that when I save a file, the editor window's GUI refreshes after saving (yellow margin indicators turn green) and THEN the editor window closes (after some delay).  If I try to close the editor window directly and save changes when prompted, the tab disappears immediately, then the editor window closes entirely after a delay.

Oh, right, that delay may be another important detail; see new attachment (unsaved at left, saved at right, moments before the editor window closes).
« Last Edit: Yesterday at 01:36:11 am by Stratelier »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2931
Re: Why does the code editor window close after saving a file?
« Reply #4 on: Yesterday at 03:55:01 am »
Where did  that copy of CodeBlocks come from?

Please start CodeBlocks with the '/d' parameter to create the debug log.

After the windows disappears please show us the data written to the CodeBlocks log.
Click on the "CodeBlocks" log tab, place the mouse in the log window and scroll upward to see the data.
Right-click and choose "copy contents to clipboard".
Paste that data to use between code tags (The # icon above a reply box).

Do the same with the "Code::Blocks debug" tab and window.

We'd like to see what is being logged when you save a file.

Thanks for your reporting and patience.
« Last Edit: Yesterday at 04:21:38 am by Pecan »

Offline Stratelier

  • Single posting newcomer
  • *
  • Posts: 5
Re: Why does the code editor window close after saving a file?
« Reply #5 on: Yesterday at 05:56:35 am »
Where did  that copy of CodeBlocks come from?

From the official Downloads page, via the SourceForge link.  By now I've also downloaded it from the dAppCDN link -- apparently, the two installers are not byte-identical (with the SourceForge installer reported as 52,312,337 bytes; dApp installer 52,313,001 bytes).

If it helps, this is also the information reported under "Help > About" :

Code
Name                    : Code::Blocks
Version                 : 25.03-r13644
SDK Version             : 2.25.0
Scintilla Version       : 3.7.5
Author                  : The Code::Blocks Team
E-mail                  : info@codeblocks.org
Website                 : https://www.codeblocks.org
OS                      : Windows 10 (build 19045), 64-bit edition
Scaling factor          : 1.000000
Detected scaling factor : 1.000000
Display PPI             : 96x96
Display count           : 1
Display 0 (\\.\DISPLAY1): XY=[0,0]; Size=[1366,768]; Primary

wxWidgets Library (wxMSW port)
Version 3.2.7 (Unicode: wchar_t, debug level: 1),
compiled at Mar 25 2025 17:16:27

Runtime version of toolkit used is 10.0.19045.

There are no active plugins

Disabling all plugins (temporarily) was my choice here.

Quote
Please start CodeBlocks with the '/d' parameter to create the debug log.

After the windows disappears please show us the data written to the CodeBlocks log.
Click on the "CodeBlocks" log tab, place the mouse in the log window and scroll upward to see the data.
Right-click and choose "copy contents to clipboard".
Paste that data to use between code tags (The # icon above a reply box).

Do the same with the "Code::Blocks debug" tab and window.

We'd like to see what is being logged when you save a file.

Thanks for your reporting and patience.

On it.

...maybe I should have chosen a smaller project than GIMP to demonstrate with, but regardless, upon saving a file this appears in the Codeblocks main log:

Code
wxDir::GetAllFiles 0.824000 s
makePathsRelativeIfNeeded 0.807000 s
filterOnWildcards 0.318000 s
Loading directories took 2.034000 s
Adding took 10.537000 s
Loading globs took: 12.699000 s
ProjectManagerUI::RebuildTree took 0.577 seconds
Rebuilding tree took: 0.578000 s

Nothing at all appears in the Debug log when saving.

Ten seconds is a noticeable wait, but the editor window is still open prior to that.

And this is the full log (open project, open a file, dummy edit, save file):

Code
Opening C:\Users\strat_000\Projects\Gitlab\gimp-master\GIMP 3.dev\GIMP 3.dev.cbp
wxDir::GetAllFiles 0.782000 s
makePathsRelativeIfNeeded 0.836000 s
filterOnWildcards 0.321000 s
Loading directories took 1.949000 s
Adding took 11.026000 s
Done.
cbProject::Open() took: 42.479 seconds.
wxDir::GetAllFiles 0.811000 s
makePathsRelativeIfNeeded 0.831000 s
filterOnWildcards 0.325000 s
Loading directories took 1.984000 s
Adding took 11.021000 s
ProjectManagerUI::RebuildTree took 0.560 seconds
ProjectManager::SetProject() took: 13.670 seconds.
ProjectManager::LoadProject took: 56.614 seconds.
wxDir::GetAllFiles 0.818000 s
makePathsRelativeIfNeeded 0.829000 s
filterOnWildcards 0.318000 s
Loading directories took 1.983000 s
Adding took 10.544000 s
Loading globs took: 12.651000 s
ProjectManagerUI::RebuildTree took 0.629 seconds
Rebuilding tree took: 0.631000 s

Full debug log from the same:

Code
Loading project file...
Parsing project file...
Loading target Debug
Loading target Release
Loading project files...
3653 files loaded
Done loading project in 10547 ms
Project's base path: C:\Users\strat_000\Projects\Gitlab\gimp-master\GIMP 3.dev\
Project's common toplevel path: C:\Users\strat_000\Projects\Gitlab\gimp-master\
Mozilla universal detection engine detected 'Pure *ASCII*'.
Final encoding detected: Windows Western European (CP 1252) (ID: 33)
Conversion succeeded using wxEncodingConverter (buffer size = 12559, converted size = 12563.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2931
Re: Why does the code editor window close after saving a file?
« Reply #6 on: Yesterday at 07:19:27 am »
Where can I download the source causing the problem.
I want to re-create the problem while running CB under the debugger.

Also, are you sure that the Code Completion plugin is disabled?
That wait after saving feels like a timer pop then running some code.
Or a lock on the main gui code being released.
Very suspicious of a bug from last century.
« Last Edit: Yesterday at 08:48:51 pm by Pecan »

Offline Stratelier

  • Single posting newcomer
  • *
  • Posts: 5
Re: Why does the code editor window close after saving a file?
« Reply #7 on: Today at 12:47:08 am »
Where can I download the source causing the problem.
I want to re-create the problem while running CB under the debugger.

Also, are you sure that the Code Completion plugin is disabled?
That wait after saving feels like a timer pop then running some code.
Or a lock on the main gui code being released.
Very suspicious of a bug from last century.

Like I said, from the Sourceforge.net page linked from the Codeblocks Downloads page:
1 - https://www.codeblocks.org/downloads/binaries/#imagesoswindows48pnglogo-microsoft-windows
2 - links to -> https://sourceforge.net/projects/codeblocks/files/Binaries/25.03/Windows/codeblocks-25.03-setup.exe

For certainty, the SHA1 hash of the installer should be 99eafbb34f62cfaee58da6e0ae6e0b4ce88c9f1e (I downloaded a fresh copy from SF and it matches), though this does not match ANY of the signatures cited by the dappCDN downloads page (https://dappcdn.com/download/devtools/code-blocks?get=codeblocks-25.03-setup.exe).

If I download the equivalent installer from dappCDN, its SHA1 hash is accd7900ec89ec9bf1f45bc70dfd20dbb4a350f6 and this does match the signature cited on the page.  I will try installing that one separately for comparison.  (And in any case, the SHA1 of the main executable, codeblocks.exe, is the same either way: 7d16aadf9e10ab7fa39decedc6714bfcee5623f1)

And that is correct: I have ALL plug-ins disabled.

I would love to load one of GIMP's dependencies (like babl) just to have a second (smaller!) project as a datapoint, but for the moment I cannot actually create any new projects (no templates available), nor can I simply point CB at the source folder either.

Additionally, this all does not occur if I simply open a file directly (outside any project) and make/save changes.  There is no strange lag after saving, the editor window stays open (as it should).  And it is consistent between both installations.

In other words, this seems SPECIFICALLY correlated to the overall size of the project (as shown above in the logs: 3653 code files requiring 56.614 seconds to load).
« Last Edit: Today at 01:08:20 am by Stratelier »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2931
Re: Why does the code editor window close after saving a file?
« Reply #8 on: Today at 01:06:31 am »
@Statelier

I was asking about where to download the Gimp source that's shown in the project window.

But I finally found it (I think). Downloaded it, made a project from it, and tried to get the  problem as described. No luck though. It works ok for me. (Windows 11 64bit 32Meg memory).

Now I'll re-create cb 25.03 from source and see if I can step through "save" in the debugger with many files of Gimp loaded.

Please describe the hardware you're using. I'd like to use vmware to create a similar system and test your environment there.


« Last Edit: Today at 01:10:14 am by Pecan »

Offline Stratelier

  • Single posting newcomer
  • *
  • Posts: 5
Re: Why does the code editor window close after saving a file?
« Reply #9 on: Today at 01:17:25 am »
Sorry.  At the time I was following the instructions from developer.gimp.org (and there are quite a few more for Windows than on Linux), one of which is to fetch it via git command-line.

The issue does seem specifically related to very large projects, as I cannot reproduce it in isolated files or "hello world" sized projects.

As for my system:  A laptop from 2014 with 4GB shared RAM.  It has room for 8 to 16GB but the RAM sockets are the last thing in the teardown (ugh).  So it tends to be under a bit of stress.