[Kde-bindings] contextMenuEvent on a QGraphicsProxyWidget causes plasma to crash

David Palacio dpalacio at uninorte.edu.co
Mon Nov 17 23:55:19 UTC 2008


A QGraphicsProxyWidget is a child of a PlasmaScripting::Applet. When the 
hosted widget is right-clicked (calling a context menu) plasma crashes. If the 
proxy or the proxied widget implements contextMenuEvent there is no crash.
Affected kdebindings versions: 4.1.3 & trunk

===========Applet source code==============
require 'plasma_applet'

module PlasmaAppletHelloRuby

class Main < PlasmaScripting::Applet

  def initialize(parent, args = nil)
    super
  end

  def init
    resize(600, 400)
    proxy = Qt::GraphicsProxyWidget.new self.applet_script.applet
    proxy.widget = ( button = Qt::PushButton.new( 'Crash me' ) )
    # Uncomment the following to prevent a crash
    #class << proxy
    ##class << button #or instead subclass the widget and
    #                 #the crash still does not happen
    #  def contextMenuEvent ( event )
    #    STDERR.puts 'Do not crash plasma'
    #  end
    #end
  end

  def paintInterface(p, option, rect)
    p.pen = Qt::Color.new 'steelblue'
    p.scale 3, 3
    p.draw_text Qt::RectF.new( rect ), 'Hello Ruby'
  end

  def constraintsEvent(constraints)
  end

end

end

==P.S.==
Actually, this is not the only crash. Resizing, rotating and moving may cause 
a crash if done a few times.

===========Plasma Konsole output ==============
/.../KDE/plasma.rb:114: warning: Object#type is deprecated; use Object#class
/.../KDE/plasma.rb:114: can't convert Class into Integer (TypeError)
Plasma crashed, attempting to automatically recover

=========Backtrace=========
Aplicación: Área de trabajo de Plasma (plasma), señal SIGSEGV
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0x7fa7653e5730 (LWP 12406)]
[New Thread 0x42ef7950 (LWP 12494)]
[New Thread 0x426f6950 (LWP 12475)]
[New Thread 0x41ef5950 (LWP 12426)]
[New Thread 0x40fff950 (LWP 12419)]
[KCrash handler]
#5  0x00007fa75d5f80bb in rb_longjmp (tag=6, mesg=140356759219360)
    at eval.c:4634
#6  0x00007fa75d5f84a1 in rb_exc_raise (mesg=<value optimized out>)
    at eval.c:4650
#7  0x00007fa75d5e6ded in rb_raise (exc=140356800183840, 
    fmt=<value optimized out>) at error.c:1058
#8  0x00007fa75d6225f8 in convert_type (val=140356759102920, 
    tname=0x7fa75d670089 "Integer", method=<value optimized out>, raise=2)
    at object.c:2210
#9  0x00007fa75d62400f in rb_to_integer (val=0, 
    method=0x7fa75d66ed91 "to_int") at object.c:2266
#10 0x00007fa75d61f245 in rb_num2long (val=0) at numeric.c:1568
#11 0x00007fa75d61f4c9 in rb_num2int (val=0) at numeric.c:1625
#12 0x00007fa75cee14c6 in ruby_to_primitive<int> (v=140356759102920)
    at 
/home/david/dev/kdebindings-4.1.3/ruby/qtruby/src/marshall_primitives.h:99
#13 0x00007fa75cee1511 in marshall_from_ruby<int> (m=0x7fff78548870)
    at 
/home/david/dev/kdebindings-4.1.3/ruby/qtruby/src/marshall_basetypes.h:35
#14 0x00007fa75cee3493 in marshall_it<int> (m=0x7fff78548870)
    at /home/david/dev/kdebindings-4.1.3/ruby/qtruby/src/handlers.cpp:723
#15 0x00007fa75ceeb74e in marshall_basetype (m=0x7fff78548870)
    at /home/david/dev/kdebindings-4.1.3/ruby/qtruby/src/handlers.cpp:762
#16 0x00007fa75cefd20f in VirtualMethodReturnValue (this=0x7fff78548870, 
    smoke=0x20c2540, meth=6605, stack=0x7fff78548a60, retval=140356759102920)
    at 
/home/david/dev/kdebindings-4.1.3/ruby/qtruby/src/marshall_types.cpp:384
#17 0x00007fa75cefedeb in QtRuby::VirtualMethodCall::callMethod (
    this=0x7fff785489b0)
    at 
/home/david/dev/kdebindings-4.1.3/ruby/qtruby/src/marshall_types.cpp:519
#18 0x00007fa75cefd08f in QtRuby::MethodCallBase::next (this=0x7fff785489b0)
    at 
/home/david/dev/kdebindings-4.1.3/ruby/qtruby/src/marshall_types.cpp:459
#19 0x00007fa75cec681c in QtRuby::Binding::callMethod (this=0x7fa75af16d90, 
    method=6605, ptr=0x2770dc0, args=0x7fff78548a60)
    at /home/david/dev/kdebindings-4.1.3/ruby/qtruby/src/Qt.cpp:278
#20 0x00007fa75bf4e2c2 in x_QGraphicsProxyWidget::type (this=0x2770dc0)
    at /home/david/dev/kdebindings-4.1.3/build/smoke/qt/x_8.cpp:655
#21 0x00007fa76fab666f in Plasma::Containment::contextMenuEvent ()
   from /usr/lib/libplasma.so.2
#22 0x00007fa76eb33323 in QGraphicsItem::sceneEvent (this=0x0, event=0x2)
    at graphicsview/qgraphicsitem.cpp:3971
#23 0x00007fa76eb579e6 in QGraphicsScene::contextMenuEvent (
    this=<value optimized out>, contextMenuEvent=0x7fff78549310)
    at graphicsview/qgraphicsscene.cpp:3109
#24 0x00007fa76eb5a575 in QGraphicsScene::event (this=0x1f1f380, 
    event=0x7fff78549310) at graphicsview/qgraphicsscene.cpp:2951
#25 0x00007fa76e619a5d in QApplicationPrivate::notify_helper (this=0x1ec7580, 
    receiver=0x1f1f380, e=0x7fff78549310) at kernel/qapplication.cpp:3803
#26 0x00007fa76e6217da in QApplication::notify (this=0x1ea7100, 
    receiver=0x1f1f380, e=0x7fff78549310) at kernel/qapplication.cpp:3768
#27 0x00007fa76f61385b in KApplication::notify (this=0x1ea7100, 
    receiver=0x1f1f380, event=0x7fff78549310)
    at /tmp/buildd/kde4libs-4.1.3/kdeui/kernel/kapplication.cpp:311
#28 0x00007fa76d9e3381 in QCoreApplication::notifyInternal (this=0x1ea7100, 
    receiver=0x1f1f380, event=0x7fff78549310)
    at kernel/qcoreapplication.cpp:587
#29 0x00007fa76eb65c53 in QGraphicsView::contextMenuEvent (this=0x2752e50, 
    event=0x7fff78549bc0)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:209
#30 0x00007fa76e66c3cd in QWidget::event (this=0x2752e50, 
    event=0x7fff78549bc0) at kernel/qwidget.cpp:7320
#31 0x00007fa76eb6817b in QGraphicsView::viewportEvent (this=0x2752e50, 
    event=0x7fff78549bc0) at graphicsview/qgraphicsview.cpp:2337
#32 0x00007fa76d9e2658 in 
QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<value optimized 
out>, receiver=0x2755f40, event=0x7fff78549bc0)
    at kernel/qcoreapplication.cpp:694
#33 0x00007fa76e619a2c in QApplicationPrivate::notify_helper (this=0x1ec7580, 
    receiver=0x2755f40, e=0x7fff78549bc0) at kernel/qapplication.cpp:3799
#34 0x00007fa76e621c6a in QApplication::notify (this=<value optimized out>, 
    receiver=0x2755f40, e=0x7fff78549bc0) at kernel/qapplication.cpp:3614
#35 0x00007fa76f61385b in KApplication::notify (this=0x1ea7100, 
    receiver=0x2755f40, event=0x7fff78549bc0)
    at /tmp/buildd/kde4libs-4.1.3/kdeui/kernel/kapplication.cpp:311
#36 0x00007fa76d9e3381 in QCoreApplication::notifyInternal (this=0x1ea7100, 
    receiver=0x2755f40, event=0x7fff78549bc0)
    at kernel/qcoreapplication.cpp:587
#37 0x00007fa76e685f4b in QETWidget::translateMouseEvent (this=0x2752e50, 
    event=<value optimized out>) at kernel/qapplication_x11.cpp:4048
#38 0x00007fa76e6847ff in QApplication::x11ProcessEvent (this=0x1a6, 
    event=0x7fff7854a4b0) at kernel/qapplication_x11.cpp:3160
#39 0x00007fa76e6ac5f2 in QEventDispatcherX11::processEvents (this=0x1ec69a0, 
    flags={i = 2018813392}) at kernel/qeventdispatcher_x11.cpp:128
#40 0x00007fa76d9e1ca2 in QEventLoop::processEvents (
    this=<value optimized out>, flags={i = 2018813440})
    at kernel/qeventloop.cpp:143
#41 0x00007fa76d9e1e2d in QEventLoop::exec (this=0x7fff7854a640, flags=
      {i = 2018813520}) at kernel/qeventloop.cpp:194
#42 0x00007fa76d9e42dd in QCoreApplication::exec ()
    at kernel/qcoreapplication.cpp:845
#43 0x00007fa770117f83 in kdemain () from /usr/lib/libkdeinit4_plasma.so
#44 0x00007fa76fdc71a6 in __libc_start_main () from /lib/libc.so.6
#45 0x0000000000400629 in _start ()
#0  0x00007fa76fe46ff1 in nanosleep () from /lib/libc.so.6






More information about the Kde-bindings mailing list