Canceling Attachment dialog reverts renaming

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Canceling Attachment dialog reverts renaming

Post by chrisb »

This was reported in the German forum: https://forum.freecadweb.org/viewtopic.php?f=13&t=72222.

If an object is renamed in the tree and then the Attachment dialog is opened and cancelled, then the renaming is undone. I cannot provide a file, because the effect vanishes if the file is saved and reloaded.

To reproduce:
- create a cube -> the object is shown as "Cube" in the tree view
- rename it to "NewName" -> "NewName" is shown in the tree view
- click the ...-button of the MapMode's value field to open the Attachment dialog
- cancel the Attachment dialog
-> The name of the object has been reverted to "Cube".
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Shalmeneser
Veteran
Posts: 9474
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Canceling Attachment dialog reverts renaming

Post by Shalmeneser »

True :lol:

Code: Select all

OS: Windows 10 Version 1809
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Locale: French/France (fr_FR)
Installed mods: 
  * fasteners 0.4.3
  * fcgear 1.0.0
  * Manipulator 1.4.9
  * sheetmetal 0.2.56
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Canceling Attachment dialog reverts renaming

Post by wmayer »

It's a regression since v0.20 but worked well in v0.19 and earlier. The funny thing is that when instead of using the renaming function of the context-menu you directly change the label in the property editor it doesn't revert the change when canceling the attachment dialog.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Canceling Attachment dialog reverts renaming

Post by openBrain »

wmayer wrote: Wed Oct 05, 2022 8:49 am The funny thing is that when instead of using the renaming function of the context-menu you directly change the label in the property editor it doesn't revert the change when canceling the attachment dialog.
Not exactly (at least here). Actually it appears that if you rename using the Label property in the property editor, the bug will appear 1 time over 2 (very repeatable). Still more fun. :)
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Canceling Attachment dialog reverts renaming

Post by wmayer »

git commit 3433520a74 fixes the regression in tree view.
openBrain wrote: Wed Oct 05, 2022 8:56 am Not exactly (at least here). Actually it appears that if you rename using the Label property in the property editor, the bug will appear 1 time over 2 (very repeatable). Still more fun
What's the procedure to reproduce it?
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Canceling Attachment dialog reverts renaming

Post by openBrain »

wmayer wrote: Wed Oct 05, 2022 9:47 am What's the procedure to reproduce it?
* New document -> Part WB -> Create a Cube
* Select Cube in TreeView
* Change Label in property Editor (let's say "AAA") -> Tab
* Select Map Mode, click the "..." in the value field, cancel Task dialog => OK, Label is "AAA"
* Change Label in property Editor (let's say "BBB") -> Tab
* Select Map Mode, click the "..." in the value field, cancel Task dialog => :!: NOK, Label is "AAA"

Edit : I didn't pull your latest commit yet. ;)
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Canceling Attachment dialog reverts renaming

Post by wmayer »

OK, thanks. I can reproduce it.
Edit : I didn't pull your latest commit yet.
That's completely independent to the renaming in the property editor. So, the question is whether it's a problem with the property editor or the attachment dialog.

If you follow your instructions but look at the drop-down menu of the undo actions you will see that after the first renaming there are two actions: the creation and the renaming. If you open and cancel the dialog the first time there are still two actions.

But after renaming the box the second time there is now a third action about editing the attachment instead of editing the label. So, this means that at some point a pending transaction isn't aborted correctly.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Canceling Attachment dialog reverts renaming

Post by openBrain »

wmayer wrote: Wed Oct 05, 2022 10:48 am OK, thanks. I can reproduce it.
Great.
So, the question is whether it's a problem with the property editor or the attachment dialog.
I would first suspect property editor, because I already found a regression due to a pretty heavy refactoring of it done by realthunder (I can't remember how old are the commits but I can search for them if needed).
This is just feeling though, no technical reason. :)
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Canceling Attachment dialog reverts renaming

Post by wmayer »

Part of the issue is already present in v0.19. After renaming the box the second time there is also the wrong action (about editing the attachment) in the undo list. At least canceling the attachment dialog doesn't revert the renamed object.

In v0.18 all this worked correctly.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Canceling Attachment dialog reverts renaming

Post by wmayer »

Post Reply