Results 1 to 13 of 13

Thread: QNetworkInterface::allAddresses() crash

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QNetworkInterface::allAddresses() crash

    Hi,
    I'm trying this code

    Qt Code:
    1. QList<QNetworkInterface> qLlistaInterfaces = QNetworkInterface::allInterfaces();
    2. qLlistaInterfaces.clear();
    To copy to clipboard, switch view to plain text mode 

    When I call "clear" the program crash. I call "clear" because my program crashes when exitting the function that is calling "allInterfaces" and I found that the problem is in clearing the list.

    I'm doing something wrong?

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QNetworkInterface::allAddresses() crash

    Hi,

    Anyone can test if clearing the list, the program crash?

    Thanks,
    Òscar Llarch i Galán

  3. #3
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QNetworkInterface::allAddresses() crash

    no problem on debian linux qt 4.3.2.
    Did you build qt yourself?
    Platform?
    Compiler?
    ...

  4. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QNetworkInterface::allAddresses() crash

    Hi,

    Qt 4.3.0 Commercial on Windows XP

    Compiler: Visual Studio 2003 .NET

    Thanks,
    Òscar Llarch i Galán

  5. #5
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QNetworkInterface::allAddresses() crash

    Hi,

    Anyone can try this piece of code?

    I have two ethernet interfaces. Could this be the problem?

    Thanks,
    Òscar Llarch i Galán

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QNetworkInterface::allAddresses() crash

    I have tested the above snippet with Qt 4.3.2 and MSVC 2005 SP1. It works without any problems for me. I seem to have 4 interfaces.

    Edit: Could you paste callstack from a crash?
    Last edited by jpn; 21st November 2007 at 11:08.
    J-P Nurmi

  7. #7
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QNetworkInterface::allAddresses() crash

    Hi,

    The call Stack:

    Qt Code:
    1. ntdll.dll!7c911230()
    2. ntdll.dll!7c97c943()
    3. ntdll.dll!7c97cd80()
    4. ntdll.dll!7c970af8()
    5. kernel32.dll!7c85e7af()
    6. > msvcr71d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x01d96a88) LÃ*nea 1818 C
    7. msvcr71d.dll!_free_dbg_lk(void * pUserData=0x01d96a88, int nBlockUse=1) LÃ*nea 1143 + 0x9 C
    8. msvcr71d.dll!_free_dbg(void * pUserData=0x01d96a88, int nBlockUse=1) LÃ*nea 1081 + 0xd C
    9. msvcr71d.dll!operator delete(void * pUserData=0x01d96a88) LÃ*nea 54 + 0x10 C++
    10. MagicVision.exe!QNetworkInterface::`scalar deleting destructor'() + 0x21 C++
    11. MagicVision.exe!QList<QNetworkInterface>::node_destruct(QList<QNetworkInterface>::Node * from=0x02219034, QList<QNetworkInterface>::Node * to=0x0221903c) LÃ*nea 340 + 0x2f C++
    12. MagicVision.exe!QList<QNetworkInterface>::free(QListData::Data * data=0x02219020) LÃ*nea 539 C++
    13. MagicVision.exe!QList<QNetworkInterface>::operator=(const QList<QNetworkInterface> & l={...}) LÃ*nea 354 C++
    14. MagicVision.exe!QList<QNetworkInterface>::clear() LÃ*nea 547 + 0x24 C++
    15. MagicVision.exe!ConfiguracioIODialog::setupProjecte(CLlistaProgrames * pCProjecte=0x01c283d0) LÃ*nea 98 C++
    16. MagicVision.exe!CVistaProjecte::ConfigurarES() LÃ*nea 1105 C++
    17. MagicVision.exe!CVistaProjecte::qt_metacall(QMetaObject::Call _c=InvokeMetaMethod, int _id=20, void * * _a=0x0012bdb4) LÃ*nea 119 C++
    18. QtCored4.dll!QMetaObject::activate(QObject * sender=0x01c28860, int from_signal_index=29, int to_signal_index=30, void * * argv=0x0012bdb4) LÃ*nea 3064 + 0x46 C++
    19. QtCored4.dll!QMetaObject::activate(QObject * sender=0x01c28860, const QMetaObject * m=0x65795e74, int from_local_signal_index=2, int to_local_signal_index=3, void * * argv=0x0012bdb4) LÃ*nea 3143 + 0x15 C++
    20. QtGuid4.dll!QAbstractButton::clicked(bool _t1=false) LÃ*nea 180 + 0x17 C++
    21. QtGuid4.dll!QAbstractButtonPrivate::emitClicked() LÃ*nea 517 C++
    22. QtGuid4.dll!QAbstractButtonPrivate::click() LÃ*nea 509 C++
    23. QtGuid4.dll!QAbstractButton::mouseReleaseEvent(QMouseEvent * e=0x0012c3e8) LÃ*nea 1086 C++
    24. QtGuid4.dll!QWidget::event(QEvent * event=0x0012c3e8) LÃ*nea 6030 C++
    25. QtGuid4.dll!QAbstractButton::event(QEvent * e=0x0012c3e8) LÃ*nea 1048 C++
    26. QtGuid4.dll!QPushButton::event(QEvent * e=0x0012c3e8) LÃ*nea 651 C++
    27. QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver=0x01c28860, QEvent * e=0x0012c3e8) LÃ*nea 3536 + 0x11 C++
    28. QtGuid4.dll!QApplication::notify(QObject * receiver=0x01c28860, QEvent * e=0x0012c3e8) LÃ*nea 3235 + 0x2f C++
    29. QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver=0x01c28860, QEvent * event=0x0012c3e8) LÃ*nea 508 C++
    30. QtCored4.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver=0x01c28860, QEvent * event=0x0012c3e8) LÃ*nea 187 + 0x38 C++
    31. QtGuid4.dll!QETWidget::translateMouseEvent(const tagMSG & msg={...}) LÃ*nea 2744 + 0x14 C++
    32. QtGuid4.dll!QtWndProc(HWND__ * hwnd=0x00021032, unsigned int message=514, unsigned int wParam=0, long lParam=589835) LÃ*nea 1376 + 0xc C++
    33. user32.dll!77d18709()
    34. user32.dll!77d187eb()
    35. user32.dll!77d40494()
    36. user32.dll!77d189a5()
    37. user32.dll!77d40494()
    38. user32.dll!77d189e8()
    39. QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) LÃ*nea 519 + 0x18 C++
    40. QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) LÃ*nea 963 + 0x15 C++
    41. QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) LÃ*nea 125 C++
    42. QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) LÃ*nea 170 + 0x2d C++
    43. QtCored4.dll!QCoreApplication::exec() LÃ*nea 727 + 0x15 C++
    44. QtGuid4.dll!QApplication::exec() LÃ*nea 3034 C++
    45. MagicVision.exe!main(int argc=1, char * * argv=0x01a18468) LÃ*nea 57 + 0x6 C++
    46. MagicVision.exe!WinMain(HINSTANCE__ * instance=0x00400000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x00151f17, int cmdShow=1) LÃ*nea 103 + 0x12 C++
    47. MagicVision.exe!WinMainCRTStartup() LÃ*nea 390 + 0x39 C
    48. kernel32.dll!7c816d4f()
    49. kernel32.dll!7c8399f3()
    50. QtXmld4.dll!QXmlNamespaceSupport::prefix(const QString & uri=) LÃ*nea 728 + 0x17 C++
    To copy to clipboard, switch view to plain text mode 

    Thanks,
    Òscar Llarch i Galán

  8. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QNetworkInterface::allAddresses() crash

    Just to make sure it's not accidentally caused by your application, could you test:
    Qt Code:
    1. // main.cpp
    2. #include <QCoreApplication>
    3. #include <QNetworkInterface>
    4. #include <QtDebug>
    5.  
    6. int main(int argc, char* argv[])
    7. {
    8. QCoreApplication app(argc, argv);
    9. QList<QNetworkInterface> list = QNetworkInterface::allInterfaces();
    10. qDebug() << list;
    11. list.clear();
    12. return 0;
    13. }
    To copy to clipboard, switch view to plain text mode 

    PS. And what if you try to update to Qt 4.3.2? I couldn't see anything relevant in task-tracker or lists of changes but it works for me..
    J-P Nurmi

  9. #9
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QNetworkInterface::allAddresses() crash

    Hi,

    I attached an image that swhows that it crash.

    Will try to update to Qt 4.3.2

    Thanks,
    Attached Images Attached Images
    Òscar Llarch i Galán

  10. The following user says thank you to ^NyAw^ for this useful post:

    Agroni (15th January 2013)

  11. #10
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QNetworkInterface::allAddresses() crash

    I am facing exactly same issue. My configuration is Qt 4.6.2 using with MSVC 2005 on Win XP.
    Its crashing at the same location for me as well i.e during destruction of QNetworkInterface.

    I have tried few things as below.

    1) I get similar crash when I use
    Qt Code:
    1. QList<QNetworkInterface> list= QNetworkInterface::allInterfaces();
    To copy to clipboard, switch view to plain text mode 

    This time which destroying QNetworkInterface object.

    2) More interestingly I only get this issue in GUI based project created with VS2005. I create Qt GUI project using QtCreator 2.0.1 which has the same code and it works fine. If I create console application using VS 2005 having same code, it works fine.

    My code is very simple
    Qt Code:
    1. QList<QHostAddress> list=net.allAddresses();
    To copy to clipboard, switch view to plain text mode 

    And I get crash when 'list' goes out of scope.

    For sake of completeness here is backtrace

    Qt Code:
    1. > msvcr80d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x00cc4ea8) Line 2072 C++
    2. msvcr80d.dll!_free_dbg_nolock(void * pUserData=0x00cc4ea8, int nBlockUse=1) Line 1279 + 0x9 bytes C++
    3. msvcr80d.dll!_free_dbg(void * pUserData=0x00cc4ea8, int nBlockUse=1) Line 1220 + 0xd bytes C++
    4. msvcr80d.dll!operator delete(void * pUserData=0x00cc4ea8) Line 54 + 0x10 bytes C++
    5. GUI.exe!QHostAddress::`scalar deleting destructor'() + 0x21 bytes C++
    6. GUI.exe!QList<QHostAddress>::node_destruct(QList<QHostAddress>::Node * from=0x00cc9604, QList<QHostAddress>::Node * to=0x00cc9628) Line 402 + 0x2f bytes C++
    7. GUI.exe!QList<QHostAddress>::free(QListData::Data * data=0x00cc95f0) Line 648 C++
    8. GUI.exe!QList<QHostAddress>::~QList<QHostAddress>() Line 622 C++
    9. GUI.exe!main(int argc=1, char * * argv=0x003e8088) Line 17 + 0x22 bytes C++
    10. GUI.exe!WinMain(HINSTANCE__ * instance=0x00400000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x00151f16, int cmdShow=1) Line 131 + 0x12 bytes
    11. GUI.exe!__tmainCRTStartup() Line 589 + 0x35 bytes C
    12. GUI.exe!WinMainCRTStartup() Line 414 C
    To copy to clipboard, switch view to plain text mode 

    and windows shows the message attached with the post.

    I have two network interfaces and both are connected to internet.

    Can someone help me with this.
    Attached Images Attached Images

  12. The following user says thank you to dpatel for this useful post:

    Agroni (15th January 2013)

  13. #11
    Join Date
    Sep 2010
    Posts
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QNetworkInterface::allAddresses() crash

    Even i have faced same issue. I am using QT 4.5.3 and VS 2005.

    And in project properties -

    If I change Run time Library to /MT(Multi threaded) it will work but not allowing me to debug code.

    If I change Run time Library to /MDd(Multi threaded debug DLL) it will work but crashes in 64 bit machines...

    I want to keep option as /MT and at same time want to debug the code..

    Can any one help me?

  14. #12
    Join Date
    Sep 2012
    Posts
    4
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QNetworkInterface::allAddresses() crash

    This problem is a result of mixing multiple MS compilers of different versions. Some of those MS compilers will set the PATH to it's own location.

    To fix this problem with Qt Creator go into Projects / Build & Run / Build / Build Environment / PATH - and fix the path to use the correct path. Fix other entries too.

  15. #13
    Join Date
    Jul 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QNetworkInterface::allAddresses() crash

    Agroni is right... We were getting that same crash in the destructor and it turned out that the release version of QtNetwork4.lib was being used instead of QtNetworkd4.lib.

Similar Threads

  1. QItemDelegate Editor Crash
    By mclark in forum Qt Programming
    Replies: 13
    Last Post: 22nd March 2018, 05:06
  2. Crash handler on Win32
    By niko in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 20:41
  3. QList crash in destructor
    By mclark in forum Newbie
    Replies: 7
    Last Post: 6th December 2006, 16:27
  4. sendPostedEvents crash
    By stinos in forum Qt Programming
    Replies: 5
    Last Post: 29th October 2006, 10:43
  5. Crash: using a dialog in a model
    By Brandybuck in forum Qt Programming
    Replies: 3
    Last Post: 11th April 2006, 02:39

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.