Results 1 to 20 of 29

Thread: Complicated QwtPlotZoomer crash, possible bug? Help request.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    Hi again Uwe,
    I've been doing some more research on this bug, and although I couldnt find it via debugging (hard work!) I did manage to replicate the bug in a simple program.
    The code attached was compiled with Qt 4.4.3 and the Qwt from the svn repository which I believe was Revision 417: version 5.2.

    To get the program to crash, you have to use your mouse to zoom in and out many times. I believe the faster you zoom in and out, the faster it will crash. So I was repeatedly left clicking then right clicking at a fair pace. Make sure to do small circles too so it actually zooms in. (Note: this may cause your hand to ache!).

    On a Dual core 2GHz laptop with 2G of RAM, it takes about 1.5 minutes to crash. On lower spec PC's (tested with a P4 3GHz, 512Mb RAM) it can sometimes only take 30 seconds worth of clicking.

    Hopefully you can compile and run the attached code, but if you have any problems let me know.

    Many thanks,
    Phil Winder

    Attached: qwtCrashTest.zip - source files, ui file and a pro file.
    Attached Files Attached Files
    Best Regards,
    Phil Winder
    www.philwinder.com

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    I've tried your demo on Linux/X11 with Qwt 5.1/Qt 4.4.2 without problems.

    But your demo code does not much, so you can expect, that the reason for it is Qt downwards and Windows specific.

    I recommend to upgrade to Qt 4.4.3 build it in debug mode and rerun your demo under gdb control. And again: try to learn/understand your debugger - whenever an applicaton crashes you can see it in your debugger.

    Uwe

  3. #3
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    As stated in the above post, it was compiled in 4.4.3, so I cannot update any more.
    But yes, it does seem to be windows specific.
    Best Regards,
    Phil Winder
    www.philwinder.com

  4. #4
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    A quick update, unfortunately, I still haven't got round to debugging the code, but the crash is applicable to all of Qwt's examples with a zoom in. E.g. Bode, errorbars, etc.

    It crashes on Xp and Vista.

    I'll try and find some time to go through it this week. Hopefully. Debugging somebody else's code is a nightmare!

    Cheers,
    Phil
    Best Regards,
    Phil Winder
    www.philwinder.com

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    Quote Originally Posted by philwinder View Post
    I'll try and find some time to go through it this week. Hopefully. Debugging somebody else's code is a nightmare!
    Phil, I didn't mean, that you should debug someones code. Believe me its completely impossible to understand ( I never tried myself ) the graphics pipeline of Qt without spending a lot of time before.

    What you know is that Qt is running into an assertion in qpaintengine_raster.cpp, line 4286. Obviously CreateCompatibleDC(displayDC); returns NULL, what is the return value, when the method fails. Maybe its worth to read the MSDN docs (or google) about CreateCompatibleDC.

    The assertion might have to do with the warnings before. If those are written immediately before the assertion ( do they happen in all Qwt examples too) try to find the code line, that writes them.

    If you have a support license this should be enough information to contact the TrollTech support.

    Uwe

  6. #6
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    Hi Uwe,
    I've spent a bit of time looking thought the debug window and yes, the crash is due to the Assert statement. CreateCompatibleDC is some sort of memory management function, so I can only assume that it cannot allocate the memory for the device.

    I dont know why it cant allocate the memory though, because according to my memory gauge there is loads left.

    Do you think that this is a Qt problem? Or a windows problem? Its obviously not something to do with Qwt (How could I ever think it was!) but I am an open source user, and hence have no service contract. Shall I attempt to report a bug?

    Cheers,
    Phil
    Best Regards,
    Phil Winder
    www.philwinder.com

  7. #7
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    I'm pretty sure, that it is a Qt problem. Could you please check the warnings, that were printed before the assertion happens ?
    Together with this information I will contact the Qt support,

    Uwe

  8. #8
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    Hi Again Uwe,
    Sorry, just seen your message. I didnt manage to find any specific errors, but it was just the windows related functions returned 0, meaning that they could not allocate any memory for whatever it was.

    So, usually the function CreateDIBSection on line 4289 returns 0 meaning some sort of error, then the function CreateCompatibleDC returns 0 and finally crashes the program. However, the actual order of these two have been different, ie. sometimes the CreateCompatibleDC flags an error first, sometimes the CreateDIBSection does.

    I already sent a bug report to Trolltech and they referred me back to you! Message as follows:
    Hi Phil,

    There is no way that I can see if this is a QWT problem or a Qt problem.
    QWT is an external product. Please report this to Uwe in the
    forum(which I can see you have done), and he will file a bug if the
    problem is Qt related.

    Thanks,
    Morten
    Thanks,
    Phil
    Best Regards,
    Phil Winder
    www.philwinder.com

  9. #9
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    I will have a look at the problem the next time I will check Qwt on Windows ( what might take some time ).

    Uwe

  10. The following 2 users say thank you to Uwe for this useful post:

    jomarin (12th December 2008), philwinder (3rd November 2008)

  11. #10
    Join Date
    Sep 2008
    Posts
    26
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    Hi everyone,

    I have a similar problem on Windows. My QwtPlot window crashes after a number of zoom in and out, that seems to depend on the machine used.

    I did not experience the same problem on Solaris.

    Any news on this subject ?

    Thanks in advance,

    Joel.

  12. #11
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    Ah, I am glad it is not just me. I still have the problem, and I do think it is restricted to windows. They must handle their graphics memory management differently. Having you on board with the same problem may inspire Uwe to take a look at the problem.
    Best Regards,
    Phil Winder
    www.philwinder.com

  13. #12
    Join Date
    Nov 2006
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Complicated QwtPlotZoomer crash, possible bug? Help request.

    Same problem on windows XP, VS 2003 7.1 SP1, Qt 4.4.0, Qwt 5.0.2 & 5.1.0 & 5.1.1.

    Gianni

Tags for this Thread

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.