| Summary: | Using jis7 encoding causes the entire Konsole to freeze. | ||
|---|---|---|---|
| Product: | [Applications] konsole | Reporter: | David Capel <wot.narg> |
| Component: | general | Assignee: | Konsole Bugs <konsole-bugs-null> |
| Status: | RESOLVED LATER | ||
| Severity: | normal | CC: | adaptee |
| Priority: | NOR | ||
| Version First Reported In: | 1.6.6 | ||
| Target Milestone: | --- | ||
| Platform: | Debian testing | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
David Capel
2005-10-16 22:47:33 UTC
Yep, it freezes using 100% CPU. Same here. Only goes to about 92.5% CPU, though :) My version of Konsole is 1.6 from SVN Branch 3.5. All the rest of my KDE is compiled from Branch 3.5 as well. Also, I am running Fedora Core 3. Bug in the code, but I don't know whose fault it is.
297 void TEmulation::onRcvBlock(const char *s, int len)
298 {
299 emit notifySessionState(NOTIFYACTIVITY);
300
301 bulkStart();
302 for (int i = 0; i < len; i++)
303 {
304
305 QString result = decoder->toUnicode(&s[i],1);
306 int reslen = result.length();
307
308 // If we get a control code halfway a multi-byte sequence
309 // we flush the decoder and continue with the control code.
310 if ((s[i] < 32) && (s[i] > 0))
311 {
312 // Flush decoder
313 while(!result.length())
314 result = decoder->toUnicode(&s[i],1);
315 reslen = 1;
316 result.setLength(reslen);
317 result[0] = QChar(s[i]);
318 }
decoder is of type QJisDecoder.
The problem is that:
1) decoder is in state "esc"
2) decoder->toUnicode("\033",1) returns an empty QString
3) the loop in lines 313 and 314 is infinite if the decoder returns an empty string.
Maybe an increment on i was forgotten on the 313-314 loop?
SVN commit 480087 by hindenburg:
Remove jis7 from Encoding menu due to infinite loop.
CCBUG: 114535
M +3 -0 konsole.cpp
--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #480086:480087
@@ -632,6 +632,9 @@
selectSetEncoding = new KSelectAction( i18n( "&Encoding" ), SmallIconSet( "charset" ), 0, this, SLOT(slotSetEncoding()), actions, "set_encoding" );
QStringList list = KGlobal::charsets()->descriptiveEncodingNames();
list.prepend( i18n( "Default" ) );
+
+ // BR114535 : Remove jis7 due to infinite loop.
+ list.remove( i18n( "Japanese ( jis7 )" ) );
selectSetEncoding->setItems(list);
selectSetEncoding->setCurrentItem (0);
selectSetEncoding->plug(m_options);
SVN commit 480103 by hindenburg:
Let's handle the jis7 problem this way. That way the translators don't have
any new strings and I don't have to worry about the loading/saving not working
again. It is too bad it is not possible to disable an item in a KSelectAction.
CCBUG: 107329
CCBUG: 114535
M +8 -6 konsole.cpp
--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #480102:480103
@@ -632,11 +632,6 @@
selectSetEncoding = new KSelectAction( i18n( "&Encoding" ), SmallIconSet( "charset" ), 0, this, SLOT(slotSetEncoding()), actions, "set_encoding" );
QStringList list = KGlobal::charsets()->descriptiveEncodingNames();
list.prepend( i18n( "Default" ) );
-
- // BR114535 : Remove jis7 due to infinite loop.
- // If you fix this issue and remove the line below, remember to
- // remove the line in setSessionEncoding() (search for jis7).
- list.remove( i18n( "Japanese ( jis7 )" ) );
selectSetEncoding->setItems(list);
selectSetEncoding->setCurrentItem (0);
selectSetEncoding->plug(m_options);
@@ -863,6 +858,14 @@
bool found;
QString enc = KGlobal::charsets()->encodingForName(selectSetEncoding->currentText());
qtc = KGlobal::charsets()->codecForName(enc, found);
+
+ // BR114535 : Remove jis7 due to infinite loop.
+ if ( enc == "jis7" ) {
+ kdWarning()<<"Encoding Japanese (jis7) currently does not work! BR114535"<<endl;
+ qtc = QTextCodec::codecForLocale();
+ selectSetEncoding->setCurrentItem( 0 );
+ }
+
if(!found)
{
kdWarning() << "Codec " << selectSetEncoding->currentText() << " not found!" << endl;
@@ -2631,7 +2634,6 @@
}
i++; // Take into account the first entry: Default
- if ( i > 24 ) i--; // Handle the removed jis7 entry
//kdDebug()<<"setSessionEncoding="<<encoding<<"; "<<i<<endl;
session->setEncodingNo( i );
Not a crash since user can't pick jis7. After commenting-out the jis7 check in konsole.cpp in the latest KDE 3.5 branch with Qt 3.3.7 and KDE 3.5.6 libraries I was able to run Konsole and pick the jis7 encoding without problems. Is there anyone here who could double-check this with similar Qt,KDE versions and report on whether the problem still exists?
Index: konsole.cpp
===================================================================
--- konsole.cpp (revision 611528)
+++ konsole.cpp (working copy)
@@ -869,12 +869,14 @@
QString enc = KGlobal::charsets()->encodingForName(selectSetEncoding->currentText());
qtc = KGlobal::charsets()->codecForName(enc, found);
+# if 0
// BR114535 : Remove jis7 due to infinite loop.
if ( enc == "jis7" ) {
kdWarning()<<"Encoding Japanese (jis7) currently does not work! BR114535"<<endl;
qtc = QTextCodec::codecForLocale();
selectSetEncoding->setCurrentItem( 0 );
}
+#endif
if(!found)
{
This problem seems fixed in KDE4 konsole Changing encoding to jis7 would not make konsole freeze when I start typing. I'm using konsole-2.7.999 |