Hello,
I ran into some trouble trying to instantiate a QWebView in a little test app. I'm using Qt 4.7 and SBCL on a Debian testing (wheezy) system. Here is the distilled code that produces the error:
(in-package :qt-user) (qt:enable-syntax) (ensure-smoke :qtwebkit) (setf qt-user:*application* (qt:make-qapplication "-display" ":0")) (defvar *window* (#_new QWidget)) (defvar *webview* (#_new QWebView *window*))
The error:
The value NIL is not of type (UNSIGNED-BYTE 22). [Condition of type TYPE-ERROR]
And the backtrace:
0: (QT::UNBASH NIL)[:EXTERNAL] 1: (QT::PERFORM-CAST #<QWebView 0x0066B920> #.(SB-SYS:INT-SAP #X7FFFEFF3C260) 5568 NIL) 2: ((LAMBDA (QT::SUPER)) 15432) 3: ((LABELS QT::RECURSE) 15432) 4: ((LABELS QT::RECURSE) 28936) 5: ((LABELS QT::RECURSE) 5568) 6: (QT::MAP-CPL #<CLOSURE (LAMBDA #) {1003187359}> 5568)[:EXTERNAL] 7: (QT::CACHE! #<QWebView 0x0066B920>) 8: (SB-INT:SIMPLE-EVAL-IN-LEXENV (QT-INTERNAL::|QWebView50| *WINDOW*) #<NULL-LEXENV>) 9: (EVAL (QT-INTERNAL::|QWebView50| *WINDOW*))
Here is what I have learned by debugging and experimenting.
The NIL value spoken of comes from FIND-QCLASS-IN-MODULE, which is called by RESOLVE-CAST, which is called by PERFORM-CAST. That value then gets passed to UNBASH, where it results in an error. I don't fully understand the purpose of CACHE! or MAP-CPL, but it looks like MAP-CPL is traversing up the chain of superclasses for QWebView, casting the original object to each base class, and then..? The casts are successful until it gets to the superclass called QPaintDevice (indicated by 15432 in backtrace, frames 3 & 2). In other words, this returns the problematic NIL as its second return value:
(qt::resolve-cast (qt::find-qclass "QWebView") (qt::find-qclass "QPaintDevice")) =>
#.(SB-SYS:INT-SAP #X7FFFEFF3C260) NIL
The 28936 in the backtrace (frame 4) is the class QWidget, and for sake of experiment, I tried it, and that cast works:
(qt::resolve-cast (qt::find-qclass "QWebView") (qt::find-qclass "QWidget")) =>
#.(SB-SYS:INT-SAP #X7FFFEFF3C260) 5696
So why does casting from QWebView to QPaintDevice fail?
That is about as far as I have been able to go in narrowing down this issue. Hopefully this is helpful to somebody on this mailing list who understands this better than I do. Let me know if I can be of further assistance in debugging & whatnot.
Thank you!