QSA-interest Archive, February 2006
Editor crashing with segfault
Message 1 in thread
I am using QSEditor standalone (without a QSProject), and found that
it is crashing very often at operations such as inserting or deleting
parantheses. Please try if this also happens to you with the following
minimal testprogram:
#include <QApplication>
#include <qseditor.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSEditor w(0);
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}
When the window is shown, entering a single opening parantheses as
very first character will crash the application. If I however enter
something as:
function x(
It does not crash at the parantheses input. I therefore suspect a bug
in the syntax highlighter.
I am on Windows XP, Qt 4.1.0, QSA 1.2.0
--
[ signature omitted ]
Message 2 in thread
I have noticed the same thing. For me it is actually aborting on an
assertion failure, not a segfault. This is the assert I get:
ASSERT: "i >= 0" in file /usr/local/Trolltech/Qt-4.1.0/lib/
QtCore.framework/Headers/qstring.h, line 692
.. and here is the relevant portion of the stack at that point:
#0 0x097d6860 in qFatal
#1 0xbc122514 in QString::operator[] at quickinterpreter.cpp:692
#2 0xbc0da458 in EditorCompletion::doArgumentHint at completion.cpp:585
#3 0xbc0d86b8 in EditorCompletion::eventFilter at completion.cpp:377
So it has something to do with the popup function completion. I
hadn't bothered tracking it down further, instead I was just making
sure to save my work often. :)
But I figured as long as I've got it open in the debugger, I'd go
ahead and fix it since you reminded me how much it was bugging me too
-- so here's a patch:
==== tools/designer/editor/completion.cpp ====
@@ -582,6 +582,7 @@
QString part = cursor->paragraph()->string()->toString().mid
( j, cursor->index() - j + 1 );
function = function.simplifyWhiteSpace();
for (;;) {
+ if (function.length() < 1) return false;
if ( function[ (int)function.length() - 1 ] == '(' ) {
function.remove( function.length() - 1, 1 );
function = function.simplifyWhiteSpace();
Enjoy! :)
Joel Nordell
Software Engineer
ONEAC Corp.
On Feb 16, 2006, at 12:11 PM, Seneca wrote:
> I am using QSEditor standalone (without a QSProject), and found that
> it is crashing very often at operations such as inserting or deleting
> parantheses. Please try if this also happens to you with the following
> minimal testprogram:
>
> #include <QApplication>
> #include <qseditor.h>
>
> int main(int argc, char *argv[])
> {
> QApplication a(argc, argv);
> QSEditor w(0);
> w.show();
> a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
> return a.exec();
> }
>
> When the window is shown, entering a single opening parantheses as
> very first character will crash the application. If I however enter
> something as:
>
> function x(
>
> It does not crash at the parantheses input. I therefore suspect a bug
> in the syntax highlighter.
>
> I am on Windows XP, Qt 4.1.0, QSA 1.2.0
>
> --
> Seneca
>
> To unsubscribe - send "unsubscribe" in the subject to qsa-interest-
> request@xxxxxxxxxxxxx
To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx
Message 3 in thread
Hello Joel,
JN> But I figured as long as I've got it open in the debugger, I'd go
JN> ahead and fix it since you reminded me how much it was bugging me too
JN> -- so here's a patch:
Your patch works perfectly, many many thanks!
Should this be added to the tracker or will trolltech pick it up
anyway from this list?
I submitted another bug to the tracker today (103607 - Segfault after
error in indirect loaded script). Just in case anybody knows a patch
or workaround for it ;)
--
[ signature omitted ]
Message 4 in thread
Seneca wrote:
>JN> But I figured as long as I've got it open in the debugger, I'd go
>JN> ahead and fix it since you reminded me how much it was bugging me too
>JN> -- so here's a patch:
>Your patch works perfectly, many many thanks!
>Should this be added to the tracker or will trolltech pick it up
>anyway from this list?
>
>
>
Hello Seneca and Joel,
I've made a note of it, so no need to report it. Thanks to both of you. =)
best regards,
Eskil
To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx