Results 1 to 5 of 5

Thread: QwtPlotMarker segfault

  1. #1
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    5
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QwtPlotMarker segfault

    Hi,

    I am trying to use a QwtPlotMarker to show "the current step" in my graph with a vertical line.

    I have created my marker, attached it to my graph, changed lineStyle, linePen... just like in the "bode" example.

    When I run the application, it crash.. but it is quite strange.
    When I create my marker, I call setValue and everything goes fine (except that the marker is not shown in the plot).
    Then, I call setValue again each time my "current step" change and this is where the segfault appens.

    The crash occurs just after the "itemChanged()" call in QwtPlotMarker::setValue(double, double).

    To be noted that it crash only when I change the xBottomScale with setAxisScale and setAxisTitle.

    Any idea ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotMarker segfault

    Quote Originally Posted by viridis View Post
    To be noted that it crash only when I change the xBottomScale with setAxisScale and setAxisTitle.
    What arguments do you pass to these methods?

  3. #3
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    5
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QwtPlotMarker segfault

    setAxisScale(QwtPlot::xBottom, fromValue, toValue);
    setAxisTitle(QwtPlot::xBottom, "my axis title");

    fromValue and toValue represent the min and max of my xScale (in x values, not pixels).
    Indeed, I manipulate the x and y scales myself to be able to draw multiple curves which have different scales. Next, I can change the axis scale (only the Y one as all my curve have the same time base) according to the selected curve.

  4. #4
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    5
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QwtPlotMarker segfault

    After digging a little, it appears that in QwtPlotMarker constructor, the line "d_data = new PrivateData" allocates a private data object which is fine (allocation works as espected).

    Then I add curves, I change my scales...
    And then, when I do my "setValue" call on the marker, the "d_data" member points to a invalid location (0xfdfdfd) which was not the case before.

  5. #5
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    5
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QwtPlotMarker segfault

    Ok, well, I found the bug which was, of course, in my code.
    I thought QwtPlot::clear() will remove only curves, but markers are too...

Similar Threads

  1. QwtPlotMarker confusion
    By baray98 in forum Qwt
    Replies: 3
    Last Post: 20th July 2008, 10:47
  2. Segfault when retrieving info from QSettings
    By codeslicer in forum Qt Programming
    Replies: 21
    Last Post: 21st March 2008, 09:42
  3. Segfault
    By Dumbledore in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 08:31
  4. segfault
    By conexion2000 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2006, 13:34
  5. Why does setTextColor() cause a segfault?
    By johnny_sparx in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2006, 17:58

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.