Results 1 to 2 of 2

Thread: same QwtColorMap object in plot and color-bar causes crash

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question same QwtColorMap object in plot and color-bar causes crash

    Hi,

    the spectrogram example uses two separate color map objects to display the color-bar and the plot itself. In the code this is done by the lines
    Qt Code:
    1. d_spectrogram->setColorMap( new ColorMap());
    2. rightAxis->setColorMap( zInterval, new ColorMap());
    To copy to clipboard, switch view to plain text mode 
    Now in my real project (which is inspired by this example) I would like to maintain only one single colormap object, because it should be modified by the gui. However, if the same colormap object is given to the plot and the color-bar according to
    Qt Code:
    1. ColorMap * map = new ColorMap();
    2. d_spectrogram->setColorMap( map );
    3. rightAxis->setColorMap( zInterval, map);
    To copy to clipboard, switch view to plain text mode 
    the application crashes during in the destructor because both the colorbar (QwtScaleWidget) and the plot try to delete the same object which results in a double delete. How can I avoid this behaviour? I think QWT needs smart pointers as QT does to avoid such problems. Are there any workarounds or should I keep 2 objects and keep them in sync?

    Thanks, Martin

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

    alketi (13th February 2019)

Similar Threads

  1. Crash on deletion of QScriptEngine object
    By rajeshclt3 in forum Qt Programming
    Replies: 4
    Last Post: 11th August 2011, 07:48
  2. Crash on deletion of QScriptEngine object
    By The_Fallen in forum Qt Programming
    Replies: 4
    Last Post: 11th March 2010, 09:27
  3. Replies: 1
    Last Post: 1st February 2010, 15:13
  4. Replies: 2
    Last Post: 12th October 2009, 21:17
  5. Replies: 0
    Last Post: 27th May 2008, 01:00

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.