Skip to content

App: Random fixes 2#27355

Merged
hyarion merged 6 commits intoFreeCAD:mainfrom
3x380V:app
Feb 5, 2026
Merged

App: Random fixes 2#27355
hyarion merged 6 commits intoFreeCAD:mainfrom
3x380V:app

Conversation

@3x380V
Copy link
Contributor

@3x380V 3x380V commented Feb 5, 2026

A continuation of #27243, this time a bit harder to review. Includes fix for #18044, which is marked as closed by #24123, but that improves reading corrupted file, while fix included here improves writer side. Also includes fix for #18806, which is marked as fixed by #20442, but the fix here allows saving frozen object.

All patches courtesy of @wwmayer.

Cc: @chennes, @hyarion,

@github-actions github-actions bot added Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Mod: Mesh Related to the Mesh Workbench Mod: Start Related to the Start Page Mod: Materials Materials related labels Feb 5, 2026
* Do not raise an exception when saving a document and an object has
  'freeze' status because this breaks the project file and may lead
  to loss of data.
* Make 'freeze' state persistent
* When toggling 'freeze' status only work directly on the selection.
  Do not use in-list or out-list of an object because this makes it
  quite inflexible and leads to unpredictable behaviour.

This fixes issue with saving frozen files described in 18806.
Copy link
Contributor

@hyarion hyarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing too controversial, I added some thoughts in the code.
I'd like to get @FlachyJoe's input on the freeze change.

We might also want to backport some of these changes.

Do not directly pass getNameInDocument() to the ostream as this will
set the badbit in case it returns nullptr. As a result no further
output is written to the stream and leads to loss of data.

Instead the returned C string is stored in a local variable and in case
it's nullptr an empty string is passed to the ostream.

At the end of the function writeObjects() it's checked whether the
failbit or badbit is set. If yes an error message is printed and the
failbit or badbit are cleared.

This is supposed to fix the issue 18044.

In case this fix is not sufficient it can be also check for every
object inside writeObjectData()
This reduces build time when adding new Python functions because
only one file must be compiled.
@hyarion hyarion self-assigned this Feb 5, 2026
@maxwxyz maxwxyz added Type: Bug This issue or PR is related to a bug Approved: Code Quality The PR was checked for code quality and approved backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 labels Feb 5, 2026
@maxwxyz maxwxyz moved this from Queue to Merge Meeting in Merge Queue Feb 5, 2026
@maxwxyz maxwxyz added this to the 1.1 milestone Feb 5, 2026
@maxwxyz maxwxyz moved this from Merge Meeting to Approved in Merge Queue Feb 5, 2026
@hyarion hyarion merged commit 74e1d71 into FreeCAD:main Feb 5, 2026
16 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Merge Queue Feb 5, 2026
@freecad-ci-runner
Copy link
Collaborator

Backport failed for releases/FreeCAD-1-1, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin releases/FreeCAD-1-1
git worktree add -d .worktree/backport-27355-to-releases/FreeCAD-1-1 origin/releases/FreeCAD-1-1
cd .worktree/backport-27355-to-releases/FreeCAD-1-1
git switch --create backport-27355-to-releases/FreeCAD-1-1
git cherry-pick -x 6c9ad95a70bf60242826739c84579c62025d4a24 2c2cdbfe7f94735a377c06f98389f507aed0d8c1 2c3d9e2bb702d35c8c0fe688f69682f614fb09f7 c97f6e5b3f29d9a4f698686ea63067596cf29236 4f116d8de36975ca220eaf4cd75e482062c139f6 cda2b8cbdbd9838335a9cef880d5f7fa8e81e99e

@hyarion
Copy link
Contributor

hyarion commented Feb 5, 2026

Let's wait about two weeks before backporting it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved: Code Quality The PR was checked for code quality and approved backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Mod: Materials Materials related Mod: Mesh Related to the Mesh Workbench Mod: Start Related to the Start Page Type: Bug This issue or PR is related to a bug

Projects

Status: Done

6 participants