Results 1 to 6 of 6

Thread: Access violation while alt-tabbing from an actively updated plot widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,326
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 880 Times in 828 Posts

    Default Re: Access violation while alt-tabbing from an actively updated plot widget

    Quote Originally Posted by dumdidum View Post
    Some possibly relevant code snippets:
    The crash happens, when accessing the curve data. So the relevant code is how you assign the points to your curve.

    Uwe

  2. The following user says thank you to Uwe for this useful post:

    dumdidum (2nd November 2009)

  3. #2
    Join Date
    Jun 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Access violation while alt-tabbing from an actively updated plot widget

    Quote Originally Posted by Uwe View Post
    The crash happens, when accessing the curve data. So the relevant code is how you assign the points to your curve.

    Uwe
    Qt Code:
    1. void Graph::setXY(double *x, double *y, int size) {
    2. mutex.lock();
    3. crv->setData(x, y, size);
    4. mutex.unlock();
    5. }
    To copy to clipboard, switch view to plain text mode 

    The plot itself lives in the main thread, but this function is called from another thread.

  4. #3
    Join Date
    Jun 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Access violation while alt-tabbing from an actively updated plot widget

    Hurr, yeah. I get your hint now that I read the code and documents for a while: this is a threading problem. I replaced the direct function call from another thread with a signal-slot connection, which makes sure that the setData() call is handled in the appropriate thread.

    Many thanks for your guidance!

    Quote Originally Posted by http://doc.trolltech.com/4.2/threads.html#qobject-reentrancy
    Although QObject is reentrant, the GUI classes, notably QWidget and all its subclasses, are not reentrant. They can only be used from the main thread.
    Last edited by dumdidum; 17th June 2009 at 14:05.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.