Results 1 to 20 of 22

Thread: Memory corruption related to signal emission?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: Memory corruption related to signal emission?

    right, so have you debugged the values of streamOneSSRC, and the array value at that index?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  2. #2
    Join Date
    Nov 2010
    Posts
    77
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    17

    Default Re: Memory corruption related to signal emission?

    I should probably mention that _streams is a QMap. streamOneSSRC and streamTwoSSRC are uint32_t with values similar to 738621152 and 3435571404. I've asserted that

    Qt Code:
    1. assert(_streams.find(streamOneSSRC) != _streams.end());
    2. assert(_streams.find(streamTwoSSRC) != _streams.end());
    To copy to clipboard, switch view to plain text mode 

    right before the signal emission happens.

  3. #3
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: Memory corruption related to signal emission?

    Why do you think this is related to signal emission, and not to accessing the QMap ?
    Does it crash if you just print the values ?
    Qt Code:
    1. // emit newStreamFound(_streams[streamOneSSRC]);
    2. // emit newStreamFound(_streams[streamTwoSSRC]);
    3. qDebug() << _streams[streamOneSSRC];
    4. qDebug() << _streams[streamTwoSSRC];
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Nov 2010
    Posts
    77
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    17

    Default Re: Memory corruption related to signal emission?

    Nope, that seems to work just fine.

    Qt Code:
    1. VideoStream(0x7fffe4110e20)
    2. VideoStream(0x7fffe4110e90)
    To copy to clipboard, switch view to plain text mode 

    But then again if I'm dealing with a memory corruption bug this behavior could be undefined.

  5. #5
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: Memory corruption related to signal emission?

    how are you pasing the data through the signaal/slot? const ref?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  6. #6
    Join Date
    Nov 2010
    Posts
    77
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    17

    Default Re: Memory corruption related to signal emission?

    By pointer.

    Qt Code:
    1. void newStreamFound(VideoStream*);
    To copy to clipboard, switch view to plain text mode 

    _streams is a QMap<uint32_t, VideoStream*>.

  7. #7
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: Memory corruption related to signal emission?

    you've got a problem somewhere else then. emitting a signal with a pointer as an argument, and with no slots connected, does not cause a seg fault.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  8. #8
    Join Date
    Nov 2010
    Posts
    77
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    17

    Default Re: Memory corruption related to signal emission?

    Right... so it's likely to be memory corruption like I thought then? Can you conclude anything from the Valgrind memory analysis about where the error might be?

  9. #9
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: Memory corruption related to signal emission?

    seg fault is always doing something dodgy to memory isnt it?

    valgrind doesnt play too nicely with qt from what little I have read about it so not sure you can conclude much from it.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  10. #10
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: Memory corruption related to signal emission?

    Build debug version, launch with debugger and examine (post here) backtrace after crash.

  11. #11
    Join Date
    Nov 2010
    Posts
    77
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    17

    Default Re: Memory corruption related to signal emission?

    I got this from gdb.

    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff711000c in ?? () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    (gdb) backtrace
    #0 0x00007ffff711000c in ?? () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #1 0x00007ffff711101a in QPainter::QPainter(QPaintDevice*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #2 0x00007ffff73fdb3d in QFrame::paintEvent(QPaintEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #3 0x00007ffff701325b in QWidget::event(QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #4 0x00007ffff73fd7cb in QFrame::event(QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #5 0x00007ffff6fb2faf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #6 0x00007ffff6fb9c8b in QApplication::notify(QObject*, QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #7 0x00007ffff6a62dc4 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4
    #8 0x00007ffff700d202 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #9 0x00007ffff700dd32 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevic e*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
    from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #10 0x00007ffff700cf7f in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #11 0x00007ffff71ebf6a in ?? () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #12 0x00007ffff7004086 in QWidgetPrivate::syncBackingStore() () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #13 0x00007ffff7013911 in QWidget::event(QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #14 0x00007ffff741a4e1 in QMainWindow::event(QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #15 0x00007ffff6fb2faf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #16 0x00007ffff6fb9c8b in QApplication::notify(QObject*, QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #17 0x00007ffff6a62dc4 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4
    #18 0x00007ffff6a63ef1 in QCoreApplicationPrivate::sendPostedEvents(QObject* , int, QThreadData*) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4
    #19 0x00007ffff6a90703 in ?? () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4
    #20 0x00007ffff553da5d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #21 0x00007ffff553e258 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #22 0x00007ffff553e429 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #23 0x00007ffff6a90a1c in QEventDispatcherGlib::processEvents(QFlags<QEventL oop::ProcessEventsFlag>) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4
    #24 0x00007ffff7065c0f in ?? () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4
    #25 0x00007ffff6a62115 in QEventLoop::processEvents(QFlags<QEventLoop::Proce ssEventsFlag>) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4
    #26 0x00007ffff6a62366 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsF lag>) () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4
    #27 0x00007ffff6a641a4 in QCoreApplication::exec() () from /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4
    #28 0x000000000040781f in launchGUI (ip=0x7fffffffe3c6 "127.0.0.1", port=12000) at ../VideoStreamer/main.cpp:36
    #29 0x0000000000407795 in main (argc=3, argv=0x7fffffffe068) at ../VideoStreamer/main.cpp:27

  12. #12
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: Memory corruption related to signal emission?

    Can you post the code for launchGUI (or maybe whole main.cpp) ?

Similar Threads

  1. Replies: 2
    Last Post: 7th December 2010, 15:13
  2. memory corruption
    By Rambobino in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2010, 21:35
  3. Replies: 3
    Last Post: 19th January 2010, 20:26
  4. Workload to the Application:Related to Signal and Slot
    By soumyadeep_pan in forum Qt Programming
    Replies: 3
    Last Post: 1st May 2009, 11:08
  5. Replies: 3
    Last Post: 11th January 2008, 17:34

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.