[Kde-bindings] calling KParts::MainWindow#action_collection causes a crash with recent revision of korundum from 4.4 branch

Richard Dale rdale at foton.es
Wed Jan 27 22:58:14 UTC 2010


On Wednesday 27 January 2010 09:44:43 pm Richard Dale wrote:
> On Wednesday 27 January 2010 01:42:46 pm Stefano Crocco wrote:
> > With the latest revision of smoke and korundum from the 4.4 branch,
> > calling KParts::MainWindow#action_collection causes a crash (both with
> > ruby 1.8 and 1.9). You can obtain it by running the following code
> >
> > require 'korundum4'
> >
> > data = KDE::AboutData.new "test", "", KDE::ki18n("Test"), "0.1",
> >     KDE.ki18n('A test application')
> > KDE::CmdLineArgs.init ARGV, data
> > a = KDE::Application.new
> > w = KParts::MainWindow.new nil, 0
> > w.action_collection
> >
> > The same code runs perfectly with an older revision of smoke and korundum
> > (with smoke still generated using kalyptus). With the recent one,
> > instead, I get the following backtrace:
> 
> I think this is a bug in the new Smoke library generator, rather than
>  QtRuby. KParts::MainWindow has a complicated inheritance heirarchy, and it
>  might be to do with that rather than a problem with the KActionCollection
>  class.
The libsmokekde library generated by kalyptus had these casts for 
KParts::MainWindow, including one for KXMLGUIClient with the 
actionCollection() method in it:

      case 266: //KParts::MainWindow
        switch(to) {
            case 413: return (void*)(KXmlGuiWindow*)(KParts::MainWindow*)xptr;
            case 222: return (void*)(KMainWindow*)(KParts::MainWindow*)xptr;
            case 492: return (void*)(QMainWindow*)(KParts::MainWindow*)xptr;
            case 576: return (void*)(QWidget*)(KParts::MainWindow*)xptr;
            case 503: return (void*)(QObject*)(KParts::MainWindow*)xptr;
            case 504: return (void*)(QPaintDevice*)(KParts::MainWindow*)xptr;
            case 409: return (void*)(KXMLGUIBuilder*)
(KParts::MainWindow*)xptr;
            case 410: return (void*)(KXMLGUIClient*)(KParts::MainWindow*)xptr;
            case 271: return (void*)(KParts::PartBase*)
(KParts::MainWindow*)xptr;
            case 266: return (void*)(KParts::MainWindow*)
(KParts::MainWindow*)xptr;
          default: return xptr;
        }

Whereas the new generator in the KDE 4.4 branch has these casts in the 
libsmokekparts library:

    case 24:   //KParts::MainWindow
      switch(to) {
        case 29: return (void*)(KParts::PartBase*)(KParts::MainWindow*)xptr;
        case 24: return (void*)(KParts::MainWindow*)xptr;
        default: return xptr;
      }

It looks as though it is missing the casts for external classes.

-- Richard



More information about the Kde-bindings mailing list