Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Segmentation fault when using QNetworkProxy
QtWS25 Last Chance

Segmentation fault when using QNetworkProxy

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 741 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    XGuy
    wrote on last edited by
    #1

    Hi,
    In my application i have a QUDPSocket and I want to use a network proxy, but as soon as i enable proxy after about 50secs i receive a segFault! but when I don't use QNetworkProxy I don't get any segfaults!
    The thing is the connection is established with the server through proxy but after 50 secs of sending and receiving data, suddenly a segfault window is shown.

    Here is my code:

    @
    QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::Socks5Proxy);
    proxy.setHostName("192.168.16.55");
    proxy.setPort(1080);
    // if I uncomment one of below lines i get a segfault
    // QNetworkProxy::setApplicationProxy(proxy);
    // udpSocket.setProxy(proxy);
    @

    Here is the Stack trace:
    0 QObject::destroyed Qt5Cored 0x54a65c6a
    1 QSslSocket::setCiphers Qt5Networkd 0x548fc90c
    2 QSslSocket::setCiphers Qt5Networkd 0x549488c3
    3 QObject::destroyed Qt5Cored 0x54d04b9d
    4 QObject::destroyed Qt5Cored 0x54d059aa
    5 QAbstractScrollArea::setHorizontalScrollBarPolicy Qt5Widgetsd 0x5515233e
    6 QAbstractScrollArea::setHorizontalScrollBarPolicy Qt5Widgetsd 0x5514fe54
    7 QObject::destroyed Qt5Cored 0x54cbc814
    8 QObject::destroyed Qt5Cored 0x54cc20c9
    9 QObject::destroyed Qt5Cored 0x54cbd6b5
    10 QObject::destroyed Qt5Cored 0x54d46cd4
    11 QObject::destroyed Qt5Cored 0x54d44a67
    12 gapfnScSendMessage USER32 0x75fa62fa
    13 GetThreadDesktop USER32 0x75fa6d3a
    14 CharPrevW USER32 0x75fa77c4
    15 DispatchMessageW USER32 0x75fa788a
    16 QObject::destroyed Qt5Cored 0x54d45b53
    17 QObject::destroyed Qt5Cored 0x54cb93ec
    18 QObject::destroyed Qt5Cored 0x54cb9552
    19 QObject::destroyed Qt5Cored 0x54a5036d
    20 QObject::destroyed Qt5Cored 0x54a504bf
    21 QObject::destroyed Qt5Cored 0x54a596e5
    22 beginthreadex MSVCR100D 0x5da2a273
    23 beginthreadex MSVCR100D 0x5da2a204
    24 BaseThreadInitThunk kernel32 0x7688338a
    25 RtlInitializeExceptionChain ntdll32 0x771f9f72
    26 RtlInitializeExceptionChain ntdll32 0x771f9f45

    1 Reply Last reply
    0
    • X Offline
      X Offline
      XGuy
      wrote on last edited by
      #2

      Here is my sample application:
      @
      int main(int argc, char *argv[])
      {
      QCoreApplication a(argc, argv);

      QByteArray      arrData = "This is a test.";
      QHostAddress    hostAddress;
      hostAddress.setAddress("8.8.8.1");
      
      QUdpSocket      udpSocket;
      QNetworkProxy   proxy;
      proxy.setType(QNetworkProxy::Socks5Proxy);
      proxy.setHostName("192.168.16.55");
      proxy.setPort(1080);
      udpSocket.setProxy(proxy);
      
      if(udpSocket.writeDatagram(arrData, arrData.size(), hostAddress, 1195) == -1)
      {
          qDebug() << "writeDatagram failed";
          return 1;
      }
      udpSocket.waitForBytesWritten();
      
      return a.exec&#40;&#41;;
      

      }
      @

      It emits a segfault after about 50 secs and I don't know why!

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved