View Issue Details

IDProjectCategoryView StatusLast Update
0011926ScribusInternalpublic2019-06-04 20:56
Reportersommerluk Assigned Tojghali  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformIntel 64 bitOSWindowsOS Version8.1
Product Version1.4.3.svn 
Target Version1.5.4Fixed in Version1.5.4.svn 
Summary0011926: It’s possible to create various objects with the same name
DescriptionIt’s possible to create varios objects with the same name.

Steps To Reproduce1. Open a new document

2. Create a text frame. The default name is “Text1”. Change this name to “Text2”.

3. Create another text frame. Scribus will name this text frame also “Text2”.

Additional InformationIt should not be possible to create various objects with the same name.

When you save such a file, the ANNAME attribute of one of these objects seems to stay empty.
Tags#easyhack, HOST-Oman, patch_tested_ok
PatchYes

Relationships

has duplicate 0015132 closedjghali Ensure unique name when instantiating PageItem 

Activities

Kunda

2014-09-07 20:01

updater   ~0033564

Confirmed on r19483

aliyousuf

2015-10-21 07:58

reporter   ~0036771

no can not create the object on the same name

Kunda

2015-10-21 12:39

updater   ~0036774

aliyousuf, what OS plaform, Scribus version, and Scribus revision did you test this on ?

Kunda

2015-10-21 12:49

updater   ~0036775

Last edited: 2015-10-21 12:51

aliyousuf, I see 2 identical names in the Outline window. See screenshot
OSX 10.10.5 1.5.1svn r20478

Kunda

2015-10-21 12:50

updater  

2-objects-w-same-name.png (19,186 bytes)   
2-objects-w-same-name.png (19,186 bytes)   

aliyousuf

2015-10-21 16:23

reporter   ~0036785

I work on ubuntu 14.04 and


 Scribus version


Scribus Version 1.5.1.svn
09 October 2015
Build ID: C-C-T-F-C1.13.1-64bit
Using Ghostscript version 9.10

Kunda

2015-10-21 16:25

updater   ~0036786

aliyousuf, how are you building Scribus ? from source? PPA ?

Dawoodalbadi

2015-10-28 10:07

reporter   ~0037029

please see the image that i attach
it is same problem or not
it cannot accept the same name of other object
please explain if you mean some thing else

Kunda

2015-10-28 14:07

updater   ~0037039

Last edited: 2015-10-28 14:08

Dawood,
Doesn't look like you are following the step to reproduce.
Did you do these steps?

1. Open a new document
2. Create a text frame. The default name is “Text1”. Change this name to “Text2”.
3. Create another text frame.

Result: Scribus will name this text frame also “Text2”.

Edit: see 1st screenshot showing this result

Dawoodalbadi

2015-10-29 05:24

reporter   ~0037081

Last edited: 2015-10-29 05:26

thank you kunda
I produce the bug
I will try to see the problem
also it is not in windows only I produce it in win and Ubuntu

Dawoodalbadi

2015-11-08 06:44

reporter   ~0037307

hello
I found the problem of assigning default name of any new object
The responsible for this is a Variable called AnName which is located in PageItem. This variable is Qstring value generated with merging the type of object and the number of items created in this document.
what I add is a loop to check the name if it is exist or not and will change the name
I test The Patch and its work fine with me so I hope you confirm its working or not.

Dawoodalbadi

2015-11-08 06:44

reporter  

dublicateName.diff (567 bytes)   
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 20505)
+++ scribus/pageitem.cpp	(working copy)
@@ -610,7 +610,15 @@
 		break;
 	}
 	m_Doc->TotalItems++;
+	QString oldName(AnName);
+	int nameNum = m_Doc->TotalItems;
 	AnName += tmp.setNum(m_Doc->TotalItems); // +" "+QDateTime::currentDateTime().toString();
+
+	while(m_Doc->itemNameExists(AnName))
+	{
+		nameNum++;
+		AnName = oldName + tmp.setNum(nameNum);
+	}
 	uniqueNr = m_Doc->TotalItems;
 	AutoName = true;
 	setUName(AnName);
dublicateName.diff (567 bytes)   

Dawoodalbadi

2015-11-08 06:48

reporter   ~0037308

more information about AnName
its a protected variable but it have a getter called itemName()
this variable will be initialized and generated in the constructor of pageitem.cpp

Dawoodalbadi

2015-11-09 05:30

reporter   ~0037328

up to test

Kunda

2015-11-09 10:59

updater   ~0037337

Last edited: 2015-11-09 11:00

Patch works with r20542
Cannot reproduce duplicate textbox/img/randompolygon/arc etc...

Kunda

2015-11-10 15:54

updater   ~0037387

Devs, please review patch

JLuc

2015-11-23 13:48

developer   ~0037606

kunda : I attached the "patch-tested-ok" tag because you said "patch works". I hope you mean that you tested it and it fixes the issues. When not, then please delete the tag.

Kunda

2015-11-23 20:12

updater   ~0037610

Yes, patch tested and it works. Thanks Jluc

Kunda

2015-12-01 16:02

updater   ~0037773

jghali, would this patch create a slow-down issue?

ale

2016-01-12 14:03

manager   ~0038079

somehow, i keep on having the feeling that the names that scribus uses internally should not be exposed through the UI.

by default frames should not have a visible name. if somebody wants to define one, she should be free to do so. but scribus should not have problems if somebody uses the same name twice.

of course, having the same name in the UI and in the SLA helps those few people who are manually editing sla files, but we have had multiple bugs (even some long standing ones!) that are related to the naming of resources in scribus (most of the time in relationship with translation).
so, in my eyes, the real solution should very different :-)

that being said, the patch is not brilliant but looks ok and the performance hit is probably not noticeable in most cases.
a way to improve the performance could be to keep a document parameter saying if any frame of this type (or any frame at all) has ever had its name changed.
most people never change the names and when importing complex vector shapes, the check could start having an impact on the performance.

u ltd.

2018-02-06 09:17

reporter   ~0044927

Three points here:

1. Why is this patch not yet in svn? So I have made useless fixing and reporting work again.

2. For bigger python projects names of objects are very valuable. In contrast to numeric IDs you can assign static attributes to objects using names. (For example non-printed "GlobalSettings_textframe" when the scripts are to read some first settings.) Of course for fast access some kind of numeric IDs make sense.

3. The line "uniqueNr = m_Doc->TotalItems;" may create numbers which aren't unique if you delete some other object, am I right? I guess the one number which is unique is the memory address of every PageItem.

jghali

2018-02-06 23:03

administrator   ~0044931

Last edited: 2018-02-06 23:37

1. Basically no developer paid attention to his issue until now. I've committed a more complete version of the proposed patch by also modifying the copy constructor.

3. TotalItems represent the number of items created during an editing session. That numbers never goes down. So if you delete an object, this variable does not change. So it's perfectly fine to use TotalItems to generate PageItem's uniqueNr.

jghali

2018-02-06 23:36

administrator   ~0044932

>> somehow, i keep on having the feeling that the names that scribus uses internally should not be exposed through the UI

@ale, names are necessary for dialogs such as Outline window and features such as PDF forms. If we remove names completely, we have to remove both.

JLuc

2018-02-07 08:42

developer   ~0044934

@u ltd thank you for your efforts. it takes time for patches to be reviewed. Scribus core crew is verrrrry small ! Please keep on cooperation, answer requests, improve patches when required. Write on lists or come on IRC in the evening and try talking to jghali or MrB - might help sometime.

@jghali it could be u ltd refers to other patches he has also proposed :

As for naming issues he proposed 0015133

And for other not related issues :
- 0015030 Python 3 scripter update
- 0015131 Add fast & precise duplicate to core+scripter
- 0015028 Symlinked plugins are not loaded

ale

2018-02-07 10:32

manager   ~0044935

@jghali: there should be names that are internally used, untranslatable, not visible for the user *and* unique!
this is valid for all resources like the colors and the frame names.

and then there can be names that are visible to the user.
they can be translatable, scribus might try to keep them unique, but issues with the names that are visible (and editable) should not lead to issues in the way scribus works.

in the case of the frames: by default the frame would not have any visible name. but the user can define one if they need, as an example for scripting.

the outline could show the first few letters in text frame and the filename in the images... the type of shape for shapes and so on...
that would be even be more useful that what is shown now.

(on the other side, removing pdf forms would be a great idea! but that's a different topic)

Issue History

Date Modified Username Field Change
2014-01-06 16:19 sommerluk New Issue
2014-01-06 19:01 jghali Summary It’s possible to create varios objects with the same name => It’s possible to create various objects with the same name
2014-01-10 17:23 JLuc Tag Attached: easyhack
2014-09-07 20:01 Kunda Note Added: 0033564
2014-09-07 20:01 Kunda Status new => confirmed
2014-09-07 20:01 Kunda Target Version => 1.6 milestone
2014-10-15 17:07 Kunda Tag Renamed easyhack => #easyhack
2015-10-21 07:58 aliyousuf Note Added: 0036771
2015-10-21 12:39 Kunda Note Added: 0036774
2015-10-21 12:49 Kunda Note Added: 0036775
2015-10-21 12:50 Kunda File Added: 2-objects-w-same-name.png
2015-10-21 12:51 Kunda Note Edited: 0036775
2015-10-21 16:23 aliyousuf Note Added: 0036785
2015-10-21 16:25 Kunda Note Added: 0036786
2015-10-28 10:04 Dawoodalbadi File Added: Screenshot from 2015-10-28 14:03:16.png
2015-10-28 10:07 Dawoodalbadi Note Added: 0037029
2015-10-28 10:12 aliyousuf Tag Attached: HOST-Oman
2015-10-28 14:07 Kunda Note Added: 0037039
2015-10-28 14:08 Kunda Note Edited: 0037039
2015-10-28 14:08 Kunda Note Edited: 0037039
2015-10-29 05:24 Dawoodalbadi Note Added: 0037081
2015-10-29 05:24 Dawoodalbadi File Deleted: Screenshot from 2015-10-28 14:03:16.png
2015-10-29 05:26 Dawoodalbadi Note Edited: 0037081
2015-10-31 21:59 aliyousuf Tag Detached: HOST-Oman
2015-11-08 06:44 Dawoodalbadi Note Added: 0037307
2015-11-08 06:44 Dawoodalbadi File Added: dublicateName.diff
2015-11-08 06:48 Dawoodalbadi Note Added: 0037308
2015-11-08 06:49 Dawoodalbadi Tag Attached: HOST-Oman
2015-11-09 05:30 Dawoodalbadi Note Added: 0037328
2015-11-09 10:59 Kunda Note Added: 0037337
2015-11-09 10:59 Kunda Note Edited: 0037337
2015-11-09 11:00 Kunda Note Edited: 0037337
2015-11-09 11:00 Kunda Patch => No
2015-11-09 11:00 Kunda Target Version 1.6 milestone => 1.5.1
2015-11-09 21:26 Kunda Sticky Issue No => Yes
2015-11-10 15:54 Kunda Patch No => Yes
2015-11-10 15:54 Kunda Note Added: 0037387
2015-11-10 15:54 Kunda Summary It’s possible to create various objects with the same name => [Patch] It’s possible to create various objects with the same name
2015-11-23 13:46 JLuc Tag Attached: patch_tested_ok
2015-11-23 13:48 JLuc Note Added: 0037606
2015-11-23 20:12 Kunda Note Added: 0037610
2015-12-01 16:02 Kunda Note Added: 0037773
2016-01-12 14:03 ale Note Added: 0038079
2016-01-23 17:16 cbradney Target Version 1.5.1 => 1.5.3
2016-12-08 22:04 Kunda Target Version 1.5.3 => 1.5.4
2018-02-06 08:05 jghali Relationship added has duplicate 0015132
2018-02-06 09:17 u ltd. Note Added: 0044927
2018-02-06 22:51 jghali Summary [Patch] It’s possible to create various objects with the same name => It’s possible to create various objects with the same name
2018-02-06 23:03 jghali Note Added: 0044931
2018-02-06 23:04 jghali Assigned To => jghali
2018-02-06 23:04 jghali Status confirmed => resolved
2018-02-06 23:04 jghali Resolution open => fixed
2018-02-06 23:04 jghali Fixed in Version => 1.5.4.svn
2018-02-06 23:04 jghali Sticky Issue Yes => No
2018-02-06 23:36 jghali Note Added: 0044932
2018-02-06 23:37 jghali Note Edited: 0044931
2018-02-07 08:42 JLuc Note Added: 0044934
2018-02-07 10:32 ale Note Added: 0044935
2019-06-04 20:56 cbradney Status resolved => closed