[Kde-bindings] Qtruby Screenshot example program does not work on Windows

Melton, Ryan rmelton at ball.com
Thu Aug 5 16:00:41 UTC 2010


C:\data\qtruby\examples\widgets\screenshot\ruby main.rb
./screenshot.rb:92: [BUG] Segmentation fault
ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

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

I tracked this down to a problem with the QWidget::winId() const method.  It returns a HWND__* which is not in the Smoke ClassMap.

Here is a snippet from smokedata.cpp from smoke/qtgui:
static Smoke::Class classes[] = {
    { 0L, false, 0, 0, 0, 0, 0 },	// 0 (no class)
    { "HBITMAP__", true, 0, 0, 0, 0, 0 },	//1
    { "HDC__", true, 0, 0, 0, 0, 0 },	//2
    { "HFONT__", true, 0, 0, 0, 0, 0 },	//3
    { "HICON__", true, 0, 0, 0, 0, 0 },	//4
    { "HINSTANCE__", true, 0, 0, 0, 0, 0 },	//5
    { "HPALETTE__", true, 0, 0, 0, 0, 0 },	//6
    { "HRGN__", true, 0, 0, 0, 0, 0 },	//7
    { "HWND__", true, 0, 0, 0, 0, 0 },	//8

All of these H*__ classes are marked external, but they are not in any of the smoke modules.

This causes qtruby to crash in Qt.cpp resolve_classname here:

    if ((o->smoke->classes[o->classId].external)) {
        Smoke::ModuleIndex mi = o->smoke->findClass(o->smoke->className(o->classId));
        o->smoke = mi.smoke;
        o->classId = mi.index;
        return qtruby_modules.value(mi.smoke).resolve_classname(o);
    }

The call to findClass returns NullModuleIndex which then causes a seg fault at the return line.

I'm guessing similar problems would arise for methods using any of these H*__ classes.

Is this a bug in Smoke, or how should Qtruby be handling these classes?

Thanks,
Ryan




This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.



More information about the Kde-bindings mailing list