View Issue Details

IDProjectCategoryView StatusLast Update
0006166ScribusStory Editor / Text Framespublic2007-12-26 17:02
ReporterJeryde Assigned Tojghali  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWindows XPOS VersionSP2
Product Version1.3.3.9cvs 
Target Version1.3.5Fixed in Version1.3.3.10svn 
Summary0006166: Scribus Crashes when Copy-Delete (Shift + Delete)
DescriptionScribus crashes when you mark a text and the Shift-Del to copy-delete the selected content.
Steps To Reproduce1. start scribus
2. create a new document
3. create a text frame
4. open the story editor and put some text in
5. select the text
6. then Shift-Del (to copy the text and delete it from the story editor)
Scribus crashes with "Exception Access Violation"
Additional Information Information Program received signal SIGABRT, Aborted.
[Switching to Thread -1227319600 (LWP 16655)]
0xb7f6a410 in ?? ()
(gdb) bt
0 0xb7f6a410 in ?? ()
0000001 0xbf813f48 in ?? ()
0000002 0x00000006 in ?? ()
0000003 0xb6f94801 in abort () from /lib/libc.so.6
0000004 0xb6f8c7bb in __assert_fail () from /lib/libc.so.6
0000005 0x08a3ba80 in StoryText::removeChars (this=0x9435ad4, pos=0, len=19086)
    at /home/christoph/scribus135/trunk/Scribus/scribus/text/storytext.cpp:286
0000006 0x08900a74 in SEditor::deleteSel (this=0x9435ac0)
    at /home/christoph/scribus135/trunk/Scribus/scribus/story.cpp:739
0000007 0x08909b59 in SEditor::keyPressEvent (this=0x9435ac0, k=0xbf8146e4)
    at /home/christoph/scribus135/trunk/Scribus/scribus/story.cpp:359
0000008 0xb7997ce8 in QWidget::event () from /usr/lib/libQtGui.so.4
0000009 0xb7c4fd33 in QFrame::event () from /usr/lib/libQtGui.so.4
0000010 0xb7ccf071 in QAbstractScrollArea::event () from /usr/lib/libQtGui.so.4
0000011 0xb7cbb0df in QTextEdit::event () from /usr/lib/libQtGui.so.4
0000012 0xb7952e10 in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
0000013 0xb7959a32 in QApplication::notify () from /usr/lib/libQtGui.so.4
0000014 0xb74be6cb in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
0000015 0xb799fd8e in qt_sendSpontaneousEvent () from /usr/lib/libQtGui.so.4
0000016 0xb79c6d9f in QKeyMapper::sendKeyEvent () from /usr/lib/libQtGui.so.4
0000017 0xb79c8a12 in QKeyMapperPrivate::translateKeyEvent ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/libQtGui.so.4
0000018 0xb79a7599 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
0000019 0xb79c9c35 in QEventDispatcherX11::processEvents ()
   from /usr/lib/libQtGui.so.4
0000020 0xb74bdc08 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
0000021 0xb74bdd1c in QEventLoop::exec () from /usr/lib/libQtCore.so.4
0000022 0xb74c0398 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
0000023 0xb7952527 in QApplication::exec () from /usr/lib/libQtGui.so.4
0000024 0x084aecc2 in mainApp (argc=1, argv=0xbf814e64)
    at /home/christoph/scribus135/trunk/Scribus/scribus/main_nix.cpp:76
0000025 0x084aed26 in main (argc=Cannot access memory at address 0x410f
)
    at /home/christoph/scribus135/trunk/Scribus/scribus/main_nix.cpp:52
TagsNo tags attached.
Patch

Relationships

has duplicate 0006310 closedjghali Shift + Delete in SE triggers crash 
has duplicate 0006311 closedjghali using shift-delete causes crash 
child of 0005693 closedplinnell 1.3.5 bug collection (prior to roadmap) 

Activities

2007-10-20 18:25

 

6166_patch.patch (7,549 bytes)   
Index: scribus/story.cpp
===================================================================
--- scribus/story.cpp	(revision 10914)
+++ scribus/story.cpp	(working copy)
@@ -234,31 +234,31 @@
 			{
 				case Key_Delete:
 					moveCursor(QTextEdit::MoveWordForward, true);
-					deleteSel();
+					//deleteSel(); //called via removeSelectedText() by QTextEdit::keyPressEvent()
 					break;
 				case Key_Backspace:
 					moveCursor(QTextEdit::MoveWordBackward, true);
-					deleteSel();
+					//deleteSel(); //called via removeSelectedText() by QTextEdit::keyPressEvent()
 					break;
 				case Key_K:
 					moveCursor(QTextEdit::MoveLineEnd, true);
-					deleteSel();
+					//deleteSel(); //called via removeSelectedText() by QTextEdit::keyPressEvent()
 					break;
 				case Key_D:
 					moveCursor(QTextEdit::MoveForward, true);
-					deleteSel();
+					//deleteSel(); //called via removeSelectedText() by QTextEdit::keyPressEvent()
 					break;
 				case Key_H:
 					moveCursor(QTextEdit::MoveBackward, true);
-					deleteSel();
+					//deleteSel();  //called via removeSelectedText() by QTextEdit::keyPressEvent()
 					break;
 				case Key_X:
-					cut();
-					return;
+					//cut(); //called by QTextEdit::keyPressEvent()
+					//return;
 					break;
 				case Key_V:
-					paste();
-					return;
+					//paste(); //called by QTextEdit::keyPressEvent()
+					//return;
 					break;
 				case Key_Y:
 				case Key_Z:
@@ -266,7 +266,7 @@
 					return;
 					break;
 				case Key_C:
-					copyStyledText();
+					//copyStyledText(); //called via copy() by QTextEdit::keyPressEvent()
 					break;
 			}
 			break;
@@ -330,76 +330,7 @@
 					return;
 					break;
 				case Key_Delete:
-					if (!hasSelectedText())
-					{
-						ChList *chars = StyledText.at(p);
-						if (i < static_cast<int>(chars->count()))
-							chars->remove(i);
-						else
-						{
-							if (p < static_cast<int>(StyledText.count()-1))
-							{
-								struct PtiSmall *hg;
-								ChList *chars2 = StyledText.at(p+1);
-								int a = static_cast<int>(chars2->count());
-								if (a > 0)
-								{
-									int ca;
-									if (chars->count() > 0)
-										ca = chars->at(0)->cab;
-									else
-										ca = currentParaStyle;
-									for (int s = 0; s < a; ++s)
-									{
-										hg = chars2->take(0);
-										hg->cab = ca;
-										chars->append(hg);
-									}
-								}
-								StyledText.remove(p+1);
-								ParagStyles.remove(ParagStyles.at(p+1));
-							}
-						}
-					}
-					else
-						deleteSel();
-					break;
 				case Key_Backspace:
-					if (!hasSelectedText())
-					{
-						if (p >= static_cast<int>(StyledText.count()))
-							break;
-						ChList *chars = StyledText.at(p);
-						if (i > 0)
-							chars->remove(i-1);
-						else
-						{
-							if (p > 0)
-							{
-								struct PtiSmall *hg;
-								ChList *chars2 = StyledText.at(p-1);
-								int a = static_cast<int>(chars->count());
-								if (a > 0)
-								{
-									int ca;
-									if (chars2->count() > 0)
-										ca = chars2->at(0)->cab;
-									else
-										ca = chars->at(0)->cab;
-									for (int s = 0; s < a; ++s)
-									{
-										hg = chars->take(0);
-										hg->cab = ca;
-										chars2->append(hg);
-									}
-								}
-								StyledText.remove(p);
-								ParagStyles.remove(ParagStyles.at(p));
-							}
-						}
-					}
-					else
-						deleteSel();
 					break;
 				case Key_Return:
 				case Key_Enter:
@@ -419,15 +350,15 @@
 							}
 							else
 							{
-							ChList *chars2 = StyledText.at(p);
-							int a = static_cast<int>(chars2->count());
-							for (int s = i; s < a; ++s)
-							{
-								chars->append(chars2->take(i));
+								ChList *chars2 = StyledText.at(p);
+								int a = static_cast<int>(chars2->count());
+								for (int s = i; s < a; ++s)
+								{
+									chars->append(chars2->take(i));
+								}
+								StyledText.insert(p+1, chars);
+								ParagStyles.insert(ParagStyles.at(p+1), currentParaStyle);
 							}
-							StyledText.insert(p+1, chars);
-							ParagStyles.insert(ParagStyles.at(p+1), currentParaStyle);
-							}
 						}
 						else
 						{
@@ -1542,7 +1473,7 @@
 	emit SideBarUp(false);
 	if (hasSelectedText())
 	{
-		deleteSel();
+		//deleteSel();
 		removeSelectedText();
 	}
 	emit SideBarUp(true);
@@ -1595,6 +1526,102 @@
 	emit SideBarUpdate();
 }
 
+void SEditor::doKeyboardAction(KeyboardAction action)
+{
+	if (action == ActionBackspace)
+		styledTextApplyActionBackspace();
+	else if (action == ActionDelete)
+		styledTextApplyActionDelete();
+	else if (action == ActionWordBackspace || action == ActionWordDelete)
+		return;
+	QTextEdit::doKeyboardAction(action);
+}
+
+void SEditor::styledTextApplyActionBackspace()
+{
+	int parIndex, charIndex;
+	getCursorPosition(&parIndex, &charIndex);
+	if (!hasSelectedText())
+	{
+		if (parIndex >= static_cast<int>(StyledText.count()))
+			return;
+		ChList *chars = StyledText.at(parIndex);
+		if (charIndex > 0)
+			chars->remove(charIndex-1);
+		else
+		{
+			if (parIndex > 0)
+			{
+				struct PtiSmall *hg;
+				ChList *chars2 = StyledText.at(parIndex-1);
+				int a = static_cast<int>(chars->count());
+				if (a > 0)
+				{
+					int ca;
+					if (chars2->count() > 0)
+						ca = chars2->at(0)->cab;
+					else
+						ca = chars->at(0)->cab;
+					for (int s = 0; s < a; ++s)
+					{
+						hg = chars->take(0);
+						hg->cab = ca;
+						chars2->append(hg);
+					}
+				}
+				StyledText.remove(parIndex);
+				ParagStyles.remove(ParagStyles.at(parIndex));
+			}
+		}
+	}
+}
+
+void SEditor::styledTextApplyActionDelete()
+{
+	int parIndex, charIndex;
+	getCursorPosition(&parIndex, &charIndex);
+	if (!hasSelectedText())
+	{
+		ChList *chars = StyledText.at(parIndex);
+		if (charIndex < static_cast<int>(chars->count()))
+			chars->remove(charIndex);
+		else
+		{
+			if (parIndex < static_cast<int>(StyledText.count()-1))
+			{
+				struct PtiSmall *hg;
+				ChList *chars2 = StyledText.at(parIndex+1);
+				int a = static_cast<int>(chars2->count());
+				if (a > 0)
+				{
+					int ca;
+					if (chars->count() > 0)
+						ca = chars->at(0)->cab;
+					else
+						ca = currentParaStyle;
+					for (int s = 0; s < a; ++s)
+					{
+						hg = chars2->take(0);
+						hg->cab = ca;
+						chars->append(hg);
+					}
+				}
+				StyledText.remove(parIndex+1);
+				ParagStyles.remove(ParagStyles.at(parIndex+1));
+			}
+		}
+	}
+}
+
+void SEditor::removeSelectedText (int selNum)
+{
+	if (selNum == 0 && hasSelectedText())
+	{
+		deleteSel();
+		QTextEdit::removeSelectedText(selNum);
+	}
+}
+
 QPopupMenu* SEditor::createPopupMenu(const QPoint & pos)
 {
 	QPopupMenu *p = QTextEdit::createPopupMenu(pos);
@@ -3174,7 +3201,7 @@
 	EditorBar->setRepaint(false);
 	if (Editor->hasSelectedText())
 	{
-		Editor->deleteSel();
+		//Editor->deleteSel();
 		Editor->removeSelectedText();
 	}
 	EditorBar->setRepaint(true);
Index: scribus/story.h
===================================================================
--- scribus/story.h	(revision 10914)
+++ scribus/story.h	(working copy)
@@ -152,10 +152,15 @@
 	QPopupMenu* createPopupMenu(const QPoint & pos);
 	StoryEditor* parentStoryEditor;
 
+	void styledTextApplyActionBackspace();
+	void styledTextApplyActionDelete();
+
 public slots:
-	void cut();
-	void copy();
-	void paste();
+	virtual void cut();
+	virtual void copy();
+	virtual void paste();
+	virtual void doKeyboardAction(KeyboardAction action);
+	virtual void removeSelectedText(int selNum = 0);
 	void ClipChange();
 	void SelClipChange();
 
6166_patch.patch (7,549 bytes)   

jghali

2007-10-20 20:31

administrator   ~0017717

Crash fixed in 1.3.3.10svn.

jghali

2007-10-20 21:24

administrator   ~0017718

Works ok too in 1.3.5svn after fix for 0006184

christoph_s

2007-10-20 23:15

developer   ~0017719

Tested, fixed. Thanks.

Issue History

Date Modified Username Field Change
2007-08-29 08:54 Jeryde New Issue
2007-08-29 11:11 jghali Status new => confirmed
2007-09-30 09:21 cbradney Relationship added related to 0006310
2007-09-30 10:33 jghali Summary Scribus Crashes when Copy-Delete => Scribus Crashes when Copy-Delete (Shift + Delete)
2007-09-30 10:36 jghali Relationship replaced has duplicate 0006310
2007-09-30 10:36 jghali Relationship added has duplicate 0006311
2007-09-30 10:37 jghali Relationship added child of 0005693
2007-09-30 10:39 jghali Additional Information Updated
2007-10-20 18:25 jghali File Added: 6166_patch.patch
2007-10-20 20:31 jghali Note Added: 0017717
2007-10-20 21:24 jghali Status confirmed => resolved
2007-10-20 21:24 jghali Fixed in Version => 1.3.3.10cvs
2007-10-20 21:24 jghali Resolution open => fixed
2007-10-20 21:24 jghali Assigned To => jghali
2007-10-20 21:24 jghali Note Added: 0017718
2007-10-20 23:15 christoph_s Status resolved => closed
2007-10-20 23:15 christoph_s Note Added: 0017719
2007-12-20 22:52 cbradney Target Version => 1.3.5svn
2007-12-26 17:02 cbradney Target Version 1.3.5svn => 1.3.5
2015-09-17 20:08 Kunda Category Story Editor / Text Frames => Story Ed/Txt Frames
2015-09-17 20:12 Kunda Category Story Ed/Txt Frames => Story Editor / Text Frames