QKeySequence broken in EQL::version[] = "10.12.6"; // 2010-12-14

13 views
Skip to first unread message

adarkman ad

unread,
Dec 14, 2010, 12:00:46 PM12/14/10
to eql-user
On EQL::version[] = "10.11.2"; // 2010-11-25:

(qfun action "setShortcut" "Ctrl+S") - where action - QAction - works
well

On EQL::version[] = "10.12.6"; // 2010-12-14:

(qfun action "setShortcut" "Ctrl+S") - segmentation fault

(qnew "QKeySequence(QString)" "F5") -
[EQL:error] QNEW-INSTANCE ("QKeySequence(QString)" ("F5"))

What has happened?

Polos Ruetz

unread,
Dec 14, 2010, 1:29:39 PM12/14/10
to eql-...@googlegroups.com
2010/12/14, adarkman ad <ad.da...@gmail.com>:

> (qnew "QKeySequence(QString)" "F5") -
> [EQL:error] QNEW-INSTANCE ("QKeySequence(QString)" ("F5"))
>
> What has happened?

That's strange; I tested the above today in both Linux and OSX, and it
works just fine (as I need it in example 9).

Does the new example 9 (EQL 10.12.6) work for you?

If not, what exact OS (type and version) are you using?

Paul

Polos Ruetz

unread,
Dec 14, 2010, 1:43:13 PM12/14/10
to eql-...@googlegroups.com
2010/12/14, adarkman ad <ad.da...@gmail.com>:

> On EQL::version[] = "10.11.2"; // 2010-11-25:
>
> (qfun action "setShortcut" "Ctrl+S") - where action - QAction - works
> well
>
> On EQL::version[] = "10.12.6"; // 2010-12-14:
>
> (qfun action "setShortcut" "Ctrl+S") - segmentation fault

...and sorry for that, but I really saw the need to move QKeySequence
from primitives to objects (I hope this kind of changes will not be
needed in future).

Anyway, please remember: I only change the EQL version number if
something changed to the library itself, which means:
On every change of the version number, you need to rebuild the whole
EQL library, including all modules.

(Windows note: this can even be tricky: on my Windows 7, with my
personal configuration, I always need to manually delete all compiled
*.obj files from a previous build, simply by manually deleting the
"C:\eql\src\tmp" directory, because a "nmake clean" simply does not(!)
clean-up a previous build!)

Paul

adarkman ad

unread,
Dec 15, 2010, 3:35:24 AM12/15/10
to eql-user
On 14 дек, 20:29, Polos Ruetz <polos.ru...@gmail.com> wrote:

> That's strange; I tested the above today in both Linux and OSX, and it
> works just fine (as I need it in example 9).
>
> Does the new example 9 (EQL 10.12.6) work for you?

After full EQL full rebuild with src/tmp removal:

eql local-server - working

eql editor:

;;; Loading #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-
editor/editor.lisp"
;;; Loading #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-
editor/local-client.lisp"

Detected access to an invalid or protected memory address.
Available restarts:

1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at SET-FORMAT. In: #<process SI:TOP-LEVEL 0000000000665f60>.
File: #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-editor/
editor.lisp" (Position #11759)
EDITOR>>

>
> If not, what exact OS (type and version) are you using?

Gentoo Linux kernel 2.6.26, glibc 2.11.2, ECL 10.4.1, Qt 4.7.1

> (Windows note: this can even be tricky: on my Windows 7, with my
personal configuration, I always need to manually delete all
compiled
*.obj files from a previous build, simply by manually deleting the
"C:\eql\src\tmp" directory, because a "nmake clean" simply does
not(!)
clean-up a previous build!)

Great thx ! I'm on Linux, but only removal "src/tmp" before the
rebuild has helped. Probably it is necessary to mention it in README?

>
> Paul

Polos Ruetz

unread,
Dec 15, 2010, 5:54:31 AM12/15/10
to eql-...@googlegroups.com
2010/12/15, adarkman ad <ad.da...@gmail.com>:

> Broken at SET-FORMAT. In: #<process SI:TOP-LEVEL 0000000000665f60>.
> File: #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-editor/
> editor.lisp" (Position #11759)
> EDITOR>>

OK, I could reproduce it; the reason is simple: eql/src/first_metatype_id.pro

After changing the Qt version, you always need to build & run the
resulting exe (in fact, your first_metatype_id.h will change).

So, please do the above, then:
- delete file tmp/ecl_fun.o
- qmake eql_lib.pro
- make

and it will work (most probably).


> Great thx ! I'm on Linux, but only removal "src/tmp" before the
> rebuild has helped. Probably it is necessary to mention it in README?

Yes, thanks for the suggestion, I just added a new README-REBUILD.

Paul

adarkman ad

unread,
Dec 15, 2010, 6:35:06 AM12/15/10
to eql-user


On 15 дек, 12:54, Polos Ruetz <polos.ru...@gmail.com> wrote:
> 2010/12/15, adarkman ad <ad.dark...@gmail.com>:
>
> > Broken at SET-FORMAT. In: #<process SI:TOP-LEVEL 0000000000665f60>.
> > File: #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-editor/
> > editor.lisp" (Position #11759)
> > EDITOR>>
>
> OK, I could reproduce it; the reason is simple: eql/src/first_metatype_id.pro
>
> After changing the Qt version, you always need to build & run the
> resulting exe

I'm always run first_metatype_id. Before write previous mail I'm fully
rebuild
EQL with src/tmp removal and rebuilding && run first_metatype_id.

> (in fact, your first_metatype_id.h will change).
>
> So, please do the above, then:
> - delete file tmp/ecl_fun.o
> - qmake eql_lib.pro
> - make
>
> and it will work (most probably).

No, it's not work on my system:

(846) darkman@sl500:--/eql/src> rm ./first_metatype_id
(847) darkman@sl500:--/eql/src> qmake first_metatype_id.pro
(848) darkman@sl500:--/eql/src> make clean
rm -f tmp/first_metatype_id.o
rm -f *~ core *.core
(849) darkman@sl500:--/eql/src> make -j2
g++ -c -pipe -D_REENTRANT -Wall -W -DQT_NO_DEBUG -DQT_NO_KEYWORDS -
DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/
mkspecs/linux-g++ -I. -I/usr/include/qt4/QtUiTools -I/usr/include/qt4/
QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/
include/qt4 -I. -o tmp/first_metatype_id.o first_metatype_id.cpp
g++ -Wl,-O1 -Wl,-rpath,/usr/lib64/qt4 -o first_metatype_id tmp/
first_metatype_id.o -L/usr/lib64/qt4 -L/usr/lib64 -L/usr/lib64/qt4 -
L/usr/X11R6/lib -lQtUiTools -lQtXml -lQtGui -lQtCore -lgthread-2.0 -
lrt -lglib-2.0 -lpthread
(850) darkman@sl500:--/eql/src> ./first_metatype_id
(851) darkman@sl500:--/eql/src> rm tmp/ecl_fun.o
(852) darkman@sl500:--/eql/src> qmake eql_lib.pro
(853) darkman@sl500:--/eql/src> make -j2
g++ -c -pipe -D_REENTRANT -Wall -W -fPIC -DEQL_LIBRARY -DQT_NO_DEBUG -
DQT_NO_KEYWORDS -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/
usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtUiTools -I/
usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/
QtXml -I/usr/include/qt4 -Itmp -o tmp/ecl_fun.o ecl_fun.cpp
rm -f libeql.so.1.0.0 libeql.so libeql.so.1 libeql.so.1.0
g++ -Wl,-O1 -Wl,-rpath,/usr/lib64/qt4 -shared -Wl,-soname,libeql.so.1 -
o libeql.so.1.0.0 tmp/_lobjects.o tmp/dyn_object.o tmp/ecl_fun.o tmp/
eql.o tmp/moc__main_q_classes.o tmp/moc__main_q_methods.o tmp/
moc__main_n_methods.o tmp/moc_eql.o -L/usr/lib64/qt4 -lecl -L. -lini
-L/usr/lib64 -L/usr/lib64/qt4 -L/usr/X11R6/lib -lQtUiTools -lQtXml -
lQtGui -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -lpthread
ln -s libeql.so.1.0.0 libeql.so
ln -s libeql.so.1.0.0 libeql.so.1
ln -s libeql.so.1.0.0 libeql.so.1.0
rm -f ../libeql.so.1.0.0
rm -f ../libeql.so
rm -f ../libeql.so.1
rm -f ../libeql.so.1.0
mv -f libeql.so.1.0.0 libeql.so libeql.so.1 libeql.so.1.0 ../
(854) darkman@sl500:--/eql/src> sudo ldconfig

In other console start local-server ((859) darkman@sl500:--/examples/9-
simple-lisp-editor>
env LC_ALL=en_US.UTF-8 ../../eql local-server)


(855) darkman@sl500:--/examples/9-simple-lisp-editor> env
LC_ALL=C ../../eql editor
;;; Loading #P"/usr/lib64/ecl-10.4.1/asdf.fas"
;;; Loading #P"/usr/lib64/ecl-10.4.1/cmp.fas"
;;; Loading #P"/usr/lib64/ecl-10.4.1/sysfun.lsp"
ECL (Embeddable Common-Lisp) 10.4.1
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.
Top level in: #<process SI:TOP-LEVEL 0000000000665f60>.
>
;;; Loading #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-
editor/editor.lisp"
;;; Loading #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-
editor/local-client.lisp"

Detected access to an invalid or protected memory address.
Available restarts:

1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Polos Ruetz

unread,
Dec 15, 2010, 6:58:40 AM12/15/10
to eql-...@googlegroups.com
2010/12/15, adarkman ad <ad.da...@gmail.com>:

> I'm always run first_metatype_id. Before write previous mail I'm fully
> rebuild
> EQL with src/tmp removal and rebuilding && run first_metatype_id.

I understand; what is the contents of your "first_metatype_id.h"?
On my Linux, with Qt 4.7.0, it is:

257,

Now, I tried to change it to both "256," and "258," and after
rebuilding like so:


- delete file tmp/ecl_fun.o
- qmake eql_lib.pro
- make

I got the exact same error message as you (trying to run the editor.lisp):

"Broken at SET-FORMAT (Position #11759)"

Could you please try to manually edit your number in
"first_metatype_id.h" one higher (and rebuild), and then one lower of
the current value, and report the exact error message?

Paul

adarkman ad

unread,
Dec 15, 2010, 7:57:19 AM12/15/10
to eql-user


On 15 дек, 13:58, Polos Ruetz <polos.ru...@gmail.com> wrote:
> 2010/12/15, adarkman ad <ad.dark...@gmail.com>:

Qt 4.7.1: first_metatype_id.h: 275,

--------------
with 274:
Broken at SHOW-MATCHING-PARENTHESIS. In: #<process SI:TOP-LEVEL
0000000000665f60>.
File: #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-editor/
editor.lisp" (Position #38138)

with 276:
Broken at SET-FORMAT. In: #<process SI:TOP-LEVEL 0000000000665f60>.
File: #P"/home/opt/sources/Lisp/EQL/eql/examples/9-simple-lisp-editor/
editor.lisp" (Position #11759)
----------------

I think a problem can be in two places:

1. I'm have x86_64 Linux

2. In setFormat(int,int,QTextCharFormat) - QTextCharFormat declared as
value, NOT a pointer,
but in editor.lisp for example "*eql-keyword-format*" is a pointer.
Simpe test in my code:

-----------------------
(defparameter *repl-highlighter* nil)
(defparameter *CFU* (x:do-with (qnew "QTextCharFormat")
("setFontItalic" 1)))

(defun repl-highlighter-handler (text)
(unless (or (null text) (= 0 (length text)))
**1** (qfun *repl-highlighter* "setFormat(int,int,QColor)" 0
(length text) "red")
**2** ;(qfun *repl-highlighter* "setFormat(int,int,QTextCharFormat)" 0
(length text) *CFU*)
))

(defun create-repl-highlighter (repl)
(setf *repl-highlighter* (qnew
"QSyntaxHighlighter(QTextDocument*)" (qfun repl "document")))
(qoverride *repl-highlighter* "highlightBlock(QString)" #'repl-
highlighter-handler))

-----------------------

has shown: line **1** works well, but line **2** cause
"Detected access to an invalid or protected memory address."

>

Polos Ruetz

unread,
Dec 15, 2010, 8:35:06 AM12/15/10
to eql-...@googlegroups.com
2010/12/15, adarkman ad <ad.da...@gmail.com>:

> I think a problem can be in two places:
>
> 1. I'm have x86_64 Linux

Yes, this is certainly causing the trouble.
Could you please run the C debugger and send the backtrace (obviously
with the standard first_metatype_id.h):

First, in eql_lib.pro change:

CONFIG += dll no_keywords uitools release
to:
CONFIG += dll no_keywords uitools debug

and rebuild the lib.

Then run the debugger (in example 9):

gdb eql
r editor.lisp

then, after error (for the backtrace):

bt

Thanks.


> 2. In setFormat(int,int,QTextCharFormat) - QTextCharFormat declared as
> value, NOT a pointer,
> but in editor.lisp for example "*eql-keyword-format*" is a pointer.

Yes, but this is always handled correctly, don't worry. Internally EQL
*always* uses pointers (and QTextCharFormat never caused any trouble
on my 32 bit computer, and I tested quite a lot).

Paul

Polos Ruetz

unread,
Dec 15, 2010, 9:00:04 AM12/15/10
to eql-...@googlegroups.com
2010/12/15, adarkman ad <ad.da...@gmail.com>:

> (defparameter *CFU* (x:do-with (qnew "QTextCharFormat")
> ("setFontItalic" 1)))

and sorry, but your:

(defparameter *CFU* (x:do-with (qnew "QTextCharFormat")
("setFontItalic" 1)))

can't work correctly. In fact, expanding

(macroexpand-1 '(x:do-with (qnew "QTextCharFormat")
("setFontItalic" 1)))

gives:

(PROGN (QNEW "QTextCharFormat" "setFontItalic" 1))

which doesn't do what you expected (that is, the "setFontItalic" is ignored).
So use something like:

(defparameter *CFU* (let ((cfu (qnew "QTextCharFormat")))
(qfun cfu ("setFontItalic" 1))
cfu))

The x:do-with macro is intended only for e.g. qfun, qset etc., but not for qnew.

Paul

adarkman ad

unread,
Dec 15, 2010, 9:15:46 AM12/15/10
to eql-user
On 15 дек, 15:35, Polos Ruetz <polos.ru...@gmail.com> wrote:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff645f7c9 in QTextFormat::operator=(QTextFormat const&) ()
from /usr/lib64/qt4/libQtGui.so.4
(gdb) bt
#0 0x00007ffff645f7c9 in QTextFormat::operator=(QTextFormat const&)
() from /usr/lib64/qt4/libQtGui.so.4
#1 0x00007ffff64b9a0f in QSyntaxHighlighter::setFormat(int, int,
QTextCharFormat const&) () from /usr/lib64/qt4/libQtGui.so.4
#2 0x00007ffff7495e31 in Q174::MsetFormat (this=0x2ed29b0,
o=0x2fd2be0, x1=1, x2=10, x3=...) at tmp/../gen/_main_q_methods.h:1581
#3 0x00007ffff742ef19 in Q174::qt_metacall (this=0x2ed29b0,
_c=QMetaObject::InvokeMetaMethod, _id=12, _a=0x7fffffffb0c0) at tmp/
moc__main_q_methods.cpp:9480
#4 0x00007ffff72f51cf in qinvoke_method2 (l_obj=0x2886780,
l_cast=0x1, l_name=0x2de9410, l_args=0x2cccb31) at ecl_fun.cpp:1641
#5 0x00007ffff757c0ea in L21qinvoke_method () from /usr/local/lib/
libeql.so.1
#6 0x00007ffff7af97f7 in ecl_interpret () from /usr/lib/libecl.so.
10.4
#7 0x00007ffff7af981f in ecl_interpret () from /usr/lib/libecl.so.
10.4
#8 0x00007ffff7af7608 in cl_funcall () from /usr/lib/libecl.so.10.4
#9 0x00007ffff72f6616 in callOverrideFun (fun=0x2c06c80, id=303,
args=0x7fffffffbcb0) at ecl_fun.cpp:1763
#10 0x00007ffff73cde64 in LSyntaxHighlighter::highlightBlock
(this=0x2fd2be0, x1=...) at tmp/../gen/_main_q_classes.h:5260
#11 0x00007ffff64ba849 in
QSyntaxHighlighterPrivate::reformatBlock(QTextBlock const&) () from /
usr/lib64/qt4/libQtGui.so.4
#12 0x00007ffff64ba9ce in
QSyntaxHighlighterPrivate::reformatBlocks(int, int, int) () from /usr/
lib64/qt4/libQtGui.so.4
#13 0x00007ffff64badc2 in
QSyntaxHighlighter::qt_metacall(QMetaObject::Call, int, void**) ()
from /usr/lib64/qt4/libQtGui.so.4
#14 0x00007ffff7321983 in LSyntaxHighlighter::qt_metacall
(this=0x2fd2be0, _c=QMetaObject::InvokeMetaMethod, _id=6,
_a=0x7fffffffbf30) at tmp/moc__main_q_classes.cpp:7120
#15 0x00007ffff5cfe1cf in QMetaObject::activate(QObject*, QMetaObject
const*, int, void**) () from /usr/lib64/qt4/libQtCore.so.4
#16 0x00007ffff68865fa in QTextDocument::contentsChange(int, int, int)
() from /usr/lib64/qt4/libQtGui.so.4
#17 0x00007ffff647bf76 in QTextDocumentPrivate::finishEdit() () from /
usr/lib64/qt4/libQtGui.so.4
#18 0x00007ffff643e18b in
QTextControlPrivate::setContent(Qt::TextFormat, QString const&,
QTextDocument*) () from /usr/lib64/qt4/libQtGui.so.4
#19 0x00007ffff664fea1 in QTextEdit::setPlainText(QString const&) ()
from /usr/lib64/qt4/libQtGui.so.4
#20 0x00007ffff6653c4c in QTextEdit::qt_metacall(QMetaObject::Call,
int, void**) () from /usr/lib64/qt4/libQtGui.so.4
#21 0x00007ffff73222f7 in LTextEdit::qt_metacall (this=0x305d0e0,
_c=QMetaObject::InvokeMetaMethod, _id=49, _a=0x7fffffffc1f0) at tmp/
moc__main_q_classes.cpp:7659
#22 0x00007ffff72f51cf in qinvoke_method2 (l_obj=0x2dea480,
l_cast=0x1, l_name=0x2b9ef40, l_args=0x2cccc21) at ecl_fun.cpp:1641
#23 0x00007ffff757c0ea in L21qinvoke_method () from /usr/local/lib/
libeql.so.1
#24 0x00007ffff7af97f7 in ecl_interpret () from /usr/lib/libecl.so.
10.4
#25 0x00007ffff7af981f in ecl_interpret () from /usr/lib/libecl.so.
10.4
#26 0x00007ffff7afd35c in si_eval_with_env () from /usr/lib/libecl.so.
10.4
#27 0x00007ffff7b4bad0 in si_load_source () from /usr/lib/libecl.so.
10.4
#28 0x00007ffff7af7608 in cl_funcall () from /usr/lib/libecl.so.10.4
#29 0x00007ffff7b4c86f in cl_load () from /usr/lib/libecl.so.10.4
#30 0x00007ffff7af97f7 in ecl_interpret () from /usr/lib/libecl.so.
10.4
#31 0x00007ffff7afd35c in si_eval_with_env () from /usr/lib/libecl.so.
10.4
#32 0x00007ffff7aea1f0 in LC19rep () from /usr/lib/libecl.so.10.4
#33 0x00007ffff7aeb48c in L24tpl () from /usr/lib/libecl.so.10.4
#34 0x00007ffff7aec72e in L1top_level () from /usr/lib/libecl.so.10.4
#35 0x00007ffff7af98a0 in ecl_interpret () from /usr/lib/libecl.so.
10.4
#36 0x00007ffff7afd35c in si_eval_with_env () from /usr/lib/libecl.so.
10.4
#37 0x00007ffff7aed6e2 in si_safe_eval () from /usr/lib/libecl.so.10.4
#38 0x00007ffff7318a7a in eval (lisp_code=0x2ed64e8 "(with-input-from-
string (s \"(load \\\"editor\\\")\") (let ((*standard-input* s))
(si:top-level)))") at eql.cpp:14
#39 0x00007ffff73195b3 in EQL::exec (this=0x7fffffffd980, args=...) at
eql.cpp:72
#40 0x000000000040184e in main (argc=2, argv=0x7fffffffdb08) at
main.cpp:38
(gdb)



> 2010/12/15, adarkman ad <ad.dark...@gmail.com>:

adarkman ad

unread,
Dec 15, 2010, 9:22:14 AM12/15/10
to eql-user

Polos Ruetz

unread,
Dec 15, 2010, 9:53:35 AM12/15/10
to eql-...@googlegroups.com
2010/12/15, adarkman ad <ad.da...@gmail.com>:
> http://pastebin.com/8LJYXtYL

Thanks, but currently I'm stuck.
After googling a bit, I found this, but maybe it doesn't mean anything...:

http://bugreports.qt.nokia.com/secure/attachment/18279/valgrindoutput.txt

It mentions "QTextFormat::operator==", and QTextCharFormat is
inherited from QTextFormat.
If someone familiar with valgrind and reading this could give some
explanation please?

Paul

Polos Ruetz

unread,
Dec 15, 2010, 10:51:22 AM12/15/10
to eql-...@googlegroups.com

just to be sure, could you please create a simple "test.lisp"
containing this line:
(print (eql:qnew "QTextCharFormat"))

and run it:
eql test.lisp

- does it print correctly?
- if not, could you please send another backtrace?

Paul

adarkman ad

unread,
Dec 15, 2010, 11:47:19 AM12/15/10
to eql-user
On 15 дек, 16:53, Polos Ruetz <polos.ru...@gmail.com> wrote:

I'm rebuilding Qt with debug info.

In backtrace:
1) in Q174::MsetFormat (this=0x2f02d30, o=0x2f45200, x1=1, x2=10,
x3=...)
2) QSyntaxHighlighter::setFormat

in
void QSyntaxHighlighter::setFormat(int start, int count, const
QTextCharFormat &format)

(gdb) print format
$28 = (const QTextCharFormat &) @0x0: <error reading variable>
(gdb)

Is there any place in source code of "libeql.so" where i can check why
"QTextCharFormat" is NULL instead of:
#<QTextCharFormat 0x3A591D0> ?

May be any entry/function from which i can start debugging ?




> 2010/12/15, adarkman ad <ad.dark...@gmail.com>:
>
> >http://pastebin.com/8LJYXtYL
>
> Thanks, but currently I'm stuck.
> After googling a bit, I found this, but maybe it doesn't mean anything...:
>
> http://bugreports.qt.nokia.com/secure/attachment/18279/valgrindoutput...

adarkman ad

unread,
Dec 15, 2010, 11:48:43 AM12/15/10
to eql-user


On 15 дек, 17:51, Polos Ruetz <polos.ru...@gmail.com> wrote:
> 2010/12/15, adarkman ad <ad.dark...@gmail.com>:
>
> >http://pastebin.com/8LJYXtYL
>
> just to be sure, could you please create a simple "test.lisp"
> containing this line:
> (print (eql:qnew "QTextCharFormat"))

from eql -qgui:

GUI> (print (eql:qnew "QTextCharFormat"))
#<QTextCharFormat 0x326C470>

Polos Ruetz

unread,
Dec 15, 2010, 3:56:12 PM12/15/10
to eql-...@googlegroups.com
2010/12/15, adarkman ad <ad.da...@gmail.com>:

> On 15 дек, 16:53, Polos Ruetz <polos.ru...@gmail.com> wrote:
>
> I'm rebuilding Qt with debug info.

great!

> Is there any place in source code of "libeql.so" where i can check why
> "QTextCharFormat" is NULL instead of:
> #<QTextCharFormat 0x3A591D0> ?

Every function call starts from:

ecl_fun.cpp: 1641:
caller->qt_metacall(QMetaObject::InvokeMetaMethod, n, args);

Here, it then calls:

_main_q_methods.h: 1581:
Q_INVOKABLE void MsetFormat(QSyntaxHighlighter* o, int x1, int x2,
const QTextCharFormat& x3) { ((LSyntaxHighlighter*)o)->setFormat(x1,
x2, x3); }

which calls a MOC generated file. In my moc file, the line is:

moc__main_q_methods.cpp: 9480:
case 12: MsetFormat((*reinterpret_cast<
QSyntaxHighlighter*(*)>(_a[1])),(*reinterpret_cast<
int(*)>(_a[2])),(*reinterpret_cast<
int(*)>(_a[3])),(*reinterpret_cast< const
QTextCharFormat(*)>(_a[4]))); break;

I think the problem could be the "const" in "reinterpret_cast<const
...>", since I pass a normal, non-const pointer.
(see the function "static MetaArg toMetaArg(const QByteArray& sType,
cl_object l_arg)" in ecl_fun.cpp).

Since the QTextCharFormat argument is a reference (not a pointer), I
simply take the address from the heap created object, and pass it to
the qt_metacall in ecl_fun.cpp. This is probably not "good enough" for
the MOC generated file, as it expects a constant pointer for
dereferencing...

This needs probably some investigation on my side...

Paul

adarkman ad

unread,
Dec 16, 2010, 4:39:23 AM12/16/10
to eql-user
On 15 дек, 22:56, Polos Ruetz <polos.ru...@gmail.com> wrote:

> moc__main_q_methods.cpp: 9480:
> case 12: MsetFormat((*reinterpret_cast<
> QSyntaxHighlighter*(*)>(_a[1])),(*reinterpret_cast<
> int(*)>(_a[2])),(*reinterpret_cast<
> int(*)>(_a[3])),(*reinterpret_cast< const
> QTextCharFormat(*)>(_a[4]))); break;
>
> I think the problem could be the "const" in "reinterpret_cast<const
> ...>", since I pass a normal, non-const pointer.
> (see the function "static MetaArg toMetaArg(const QByteArray& sType,
> cl_object l_arg)" in ecl_fun.cpp).

No, "const" is not in the business.

-----
case 12:
printf("!!!! %d %lx\n", sizeof(long int), (long int)_a[4]);
MsetFormat((*reint......
-------
(gdb) cont
!!!! 8 0
Program received signal SIGSEGV, Segmentation fault.

I will dig further.



Polos Ruetz

unread,
Dec 16, 2010, 5:54:13 AM12/16/10
to eql-...@googlegroups.com
2010/12/16, adarkman ad <ad.da...@gmail.com>:

> No, "const" is not in the business.

Currently I'm trying to change the handling of all reference types...

Paul

Polos Ruetz

unread,
Dec 16, 2010, 9:36:42 AM12/16/10
to eql-...@googlegroups.com
2010/12/16, adarkman ad <ad.da...@gmail.com>:
> I will dig further.

There's now a new version on gitorious (10.12.7), fixing some little
things in clearMetaArg (which in theory could indirectly cause some
trouble).

Since I want to be very careful before changing anything (as for me it
runs all well in OSX, Windows and Linux, on 2 different machines),
I'll not make other experiments for now.

Paul

Polos Ruetz

unread,
Dec 16, 2010, 1:52:28 PM12/16/10
to eql-...@googlegroups.com
2010/12/16, adarkman ad <ad.da...@gmail.com>:
>

OK, let's catch that bug!

Attached you find the simplest initial test case I could think of (as
this is basically what I do internally).
When you run it, both output lines should give the same values/pointers.

Does this work for you?

Paul

QTextCharFormat_test.tgz

adarkman ad

unread,
Dec 17, 2010, 3:29:46 AM12/17/10
to eql-user
On 16 дек, 20:52, Polos Ruetz <polos.ru...@gmail.com> wrote:

> When you run it, both output lines should give the same values/pointers.
>
> Does this work for you?

Yes.

(932) darkman@sl500:--/eql/QTextCharFormat_test> ./test
[1] QVariant(QTextFormat, ) 0x6cf400
[2] QVariant(QTextFormat, ) 0x6cf400


>
> Paul
>
> QTextCharFormat_test.tgz
> < 1KбПросмотретьЗагрузить

Polos Ruetz

unread,
Dec 17, 2010, 5:54:10 AM12/17/10
to eql-...@googlegroups.com
2010/12/17, adarkman ad <ad.da...@gmail.com>:
> Yes.

OK, next step: please insert the attached code snip in ecl_fun.cpp and
run the editor example.
Are the pointers and numbers equal?

Paul

snip_ecl_fun.cpp

adarkman ad

unread,
Dec 17, 2010, 6:25:31 AM12/17/10
to eql-user


On 17 дек, 12:54, Polos Ruetz <polos.ru...@gmail.com> wrote:
> 2010/12/17, adarkman ad <ad.dark...@gmail.com>:
>
> > Yes.
>
> OK, next step: please insert the attached code snip in ecl_fun.cpp and
> run the editor example.
> Are the pointers and numbers equal?

Pointers - YES, numbers - NO:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
pointers should be equal: #<QTextCharFormat 0x2F339F0> 2F339F0
should be equal: 317 316
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


>
> Paul
>
> snip_ecl_fun.cpp
> < 1KбПросмотретьЗагрузить

Polos Ruetz

unread,
Dec 17, 2010, 6:33:51 AM12/17/10
to eql-...@googlegroups.com
2010/12/17, adarkman ad <ad.da...@gmail.com>:

> Pointers - YES, numbers - NO:
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> pointers should be equal: #<QTextCharFormat 0x2F339F0> 2F339F0
> should be equal: 317 316
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Thanks, exactly what I suspected...
I will make an internal change.

Paul

Polos Ruetz

unread,
Dec 17, 2010, 12:36:15 PM12/17/10
to eql-...@googlegroups.com
2010/12/17, adarkman ad <ad.da...@gmail.com>:

> Pointers - YES, numbers - NO:

Please try the new version 10.12.8, I removed the need for
first_metatype_id, changing some internals.

Paul

adarkman ad

unread,
Dec 20, 2010, 7:27:29 AM12/20/10
to eql-user


On 17 дек, 19:36, Polos Ruetz <polos.ru...@gmail.com> wrote:
> 2010/12/17, adarkman ad <ad.dark...@gmail.com>:
>
> > Pointers - YES, numbers - NO:
>
> Please try the new version 10.12.8, I removed the need for
> first_metatype_id, changing some internals.

Version:
const char EQL::version[] = "10.12.9"; // 2010-12-18

works for me.

>
> Paul
Reply all
Reply to author
Forward
0 new messages