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. [Linux] Some problems with arguments...
Forum Updated to NodeBB v4.3 + New Features

[Linux] Some problems with arguments...

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.9k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    Kakadu
    wrote on last edited by
    #1

    I can generate executable which crashes after ./test, but if I set three arguments or more (for instance ./test 1 2 3) the program will not crash.

    You can find code in https://github.com/Kakadu/lablqt/tree/master/simple_signals repository. To compile it you should have installed ocaml compiler. Try git://github.com/Kakadu/lablqt.git && cd lablqt/simple_signals && make && cd test && make && ./test.

    I've understand that problem is in line 794 in src/gui/kernel/qwidget_x11.cpp in Qt sources
    @ XSetWMProperties(dpy, id, 0, 0,
    qApp->d_func()->argv, qApp->d_func()->argc,
    &size;_hints, &wm;_hints, &class;_hint);@

    Here I have argc = 5, argv[0] is path to executable file (in case of calling ./test without parameters), argv[1]=argv[2] usually is 0, and accessing to argv[3] sends SIGSEGV.

    But in constructor @QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p)@
    everything is OK and argc==1.

    I think that there is a bug in Qt sources. Does anybody can explain how classes QCoreApplicationPrivate and QCoreApplication are connected and what is hidden in line qApp->d_func()->argc?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dialingo
      wrote on last edited by
      #2

      d_func() is part of Qt's Pimpl implementation, a technique to reduce compile times and to keep binary compatibility.

      In general I have the impression that you are digging too deep. Passing a couple of arguments with Qt was done a million times before. There are many reasons why things behave the way you described. Does your program do different things based on the given arguments? If not it rather looks like a pointer is accessing garbage.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kakadu
        wrote on last edited by
        #3

        My program should do the same with any arguments list.


        http://www.youtube.com/watch?v=O4an9pp_VPs
        I've created a little creencast with my attempts of debugging. Maybe it will be useful.

        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