View Issue Details

IDProjectCategoryView StatusLast Update
0016177ScribusInternalpublic2020-08-11 20:56
Reporterale Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.6.svn 
Fixed in Version1.5.6.svn 
Summary0016177: Avoid a double check for HasSel
Description... and that early return looks suspicious to me...
TagsNo tags attached.
PatchYes

Activities

ale

2020-07-19 13:58

manager  

has-sel.diff (600 bytes)   
diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp
index e71846162..84f6f7b19 100644
--- a/scribus/scribus.cpp
+++ b/scribus/scribus.cpp
@@ -4658,10 +4658,8 @@ void ScribusMainWindow::slotEditCut()
 			cItem = currItem->asTable()->activeCell().textFrame();
 		else
 			cItem = currItem->asTextFrame();
-		if (cItem->HasSel)
+		if (cItem->HasSel && cItem->itemText.length() > 0 )
 		{
-			if ((cItem->itemText.length() == 0) || (!cItem->HasSel))
-				return;
 			StoryText itemText(doc);
 			itemText.setDefaultStyle(cItem->itemText.defaultStyle());
 			itemText.insert(0, cItem->itemText, true);
has-sel.diff (600 bytes)   

jghali

2020-07-20 09:00

administrator   ~0047855

The patch is wrong as it would lead paste action to be incorrectly enabled in some cases. The early return is correct. In this case the second HasSel check has just to be removed.

ale

2020-07-20 10:39

manager   ~0047856

imo if there is a reason for returning early only for that specific case, then that should be mentioned in a commentary

Issue History

Date Modified Username Field Change
2020-07-19 13:58 ale New Issue
2020-07-19 13:58 ale File Added: has-sel.diff
2020-07-20 08:53 jghali Category General => Internal
2020-07-20 09:00 jghali Assigned To => jghali
2020-07-20 09:00 jghali Status new => resolved
2020-07-20 09:00 jghali Resolution open => fixed
2020-07-20 09:00 jghali Fixed in Version => 1.5.6.svn
2020-07-20 09:00 jghali Note Added: 0047855
2020-07-20 09:00 jghali Summary PATCH: avoid a double check for HasSel => Avoid a double check for HasSel
2020-07-20 10:39 ale Note Added: 0047856
2020-08-11 20:56 cbradney Status resolved => closed