[Qt-jambi-interest] QtJambi: Exception pending in native code

Eskil Abrahamsen Blomfeldt eblomfel at trolltech.com
Wed May 20 13:59:02 CEST 2009


Aekold Helbrass wrote:
> I got strange exception, sounds like "QtJambi: Exception pending in
> native code in file
> '..\cpp\com_trolltech_qt_gui\qtjambishell_QGraphicsRectItem.cpp':727"
> and whole application hangs writing those lines for ever.
>
> Steps to reproduce - compile following code, run it (using Qt Jambi
> 4.5.0 downloaded hour ago), and try to drag some rectangles outside of
> the view. It's because view.fitInView(this); line, without it bug will
> not be reproduced.
>   

Hi,

this is a bug in Qt causing the mouse event handler to be called 
recursively when it changes the transform of the view. To work around 
the bug, you could add a recursion guard inside your mouseMoveEvent() 
method.

    private boolean recursionGuard = false;
    public void mouseMoveEvent(QGraphicsSceneMouseEvent event) {
          if (recursionGuard) return ;
          recursionGuard = true;

          /* ... fitInView(this); ... */

          recursionGuard = false;     
    }

Hope this helps!

-- Eskil



More information about the Qt-jambi-interest mailing list