Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: Including 3rd party software makes my program crash with QFileDialog

  1. #1
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Including 3rd party software makes my program crash with QFileDialog

    Hi all!

    I am including a 3rd party software called Halcon that handles and treats camera pictures. As I have seen in the example I should include the following lines in the .pro file:

    LIBS += -L\"$/opt/halcon/lib/x64-linux2.4-gcc40\"
    unix:LIBS += -lhalconcpp -lhalcon -ldl -lpthread

    The problem is that as soon as I add the -lhalconcpp and/or the -lhalcon I can use the QFileDialog to search for files... it basically crashes everything.

    any idea why?

    thanks!

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Including 3rd party software makes my program crash with QFileDialog

    What crashes? The build? The link? The running application? What error messages are produced?

  3. #3
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Including 3rd party software makes my program crash with QFileDialog

    Run time error, message "segmentation fault", command: QString fileName = QFileDialog::getOpenFileName(this, tr("OpenFile: "),"/home/rrodrigues/Desktop");
    The whole application crashes when I call the command above.

  4. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Including 3rd party software makes my program crash with QFileDialog

    There's nothing obviously wrong with the call. Try a different directory name, or leave it off entirely (that should start the dialog in the directory where the application was started from) and see if that works. If so, the problem is with the particular directory you're trying to access; existence or permissions would be the obvious things to check.

    Failing that, turn a debugger loose on it and see if you can pin down the source of the error.

    Also, try doing a 'make clean' and a new 'make' before proceeding, just in case.

  5. #5
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Including 3rd party software makes my program crash with QFileDialog

    just as addicional information I created a new project (with only a button that opens the FileDialog) and if I add the "LIBS" to my pro file it doesn't work, if I take it it works again.
    I also tried some variations like take some parameters and try to change others but still no success.

  6. #6
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Replace QFileDialog

    Hi all!

    Because I have to include a library from a company called Halcon I can't use the QFileDialog. I already tried to include the library in many different ways and it always causes conflict when I try to browser my folders with the QFileDialog. It always terminates.

    Is there any other way to implement a File Dialog that is stable and easy to include?

    Thank you in advance.

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Replace QFileDialog

    This sounds highly improbable.
    The problem is probably in the way you are using QFileDialog, and not in the fact you are linking to Qt.
    If you show the code, and explain what you did, and the error you get, we probably might help you to make this work.
    but you have to supply us with sufficient data to help you.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. #8
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Replace QFileDialog

    I already posted the problem in another thread but I didn't get answers.
    I know it sound crazy impossible but if I had the -halcon include it doesn't work (terminates with segmentation fault) and if I take the include it works just fine.

    It is no problem with my code to open a file dialog but because I have to use the halcon library I would like to know about other way to open a file browser, please.

    thank you.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Replace QFileDialog

    Please provide a minimal compilable example reproducing the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Replace QFileDialog

    Quote Originally Posted by wysota View Post
    Please provide a minimal compilable example reproducing the problem.
    I am not trying to solve the problem because I already lost too much time trying to solve this and I couldn't find the solution. I have other thread where I tried to solve this situation here.
    Off course I would appreciate if someone reproduced the problem in their computer but that's probably asking too much. You would have to download Halcon 8.0 and include it as I did in any qt project and you see that you can't use the QFileDialog anymore.

    Do you know other way of opening a file dialog or do I have to find a magical way of solve this problem.

    thank you.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Replace QFileDialog

    Quote Originally Posted by ruben.rodrigues View Post
    Do you know other way of opening a file dialog or do I have to find a magical way of solve this problem.
    Patience is a virtue. Provide a minimal compilable example, run it and post the backtrace of the crash. Then we can talk about it. I don't know what this Halcon lib does but until we know why your code crashes, there is no point in blaming anyone.

    By the way, threads merged.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #12
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Replace QFileDialog

    Quote Originally Posted by wysota View Post
    Patience is a virtue. Provide a minimal compilable example, run it and post the backtrace of the crash. Then we can talk about it. I don't know what this Halcon lib does but until we know why your code crashes, there is no point in blaming anyone.

    By the way, threads merged.
    Can you just tell me, please, if there is another known way to open a file dialog?

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Replace QFileDialog

    Quote Originally Posted by ruben.rodrigues View Post
    Can you just tell me, please, if there is another known way to open a file dialog?
    You can always use the native API. Of course this is the same what Qt does when you use the static call (which you probably do) so it's likely you'll end up with the same result but since you really want to waste time, I'm not going to stop you. When you decide to come back for more help, please be sure to bring a backtrace of the crash with you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. #14
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Replace QFileDialog

    Quote Originally Posted by wysota View Post
    You can always use the native API. Of course this is the same what Qt does when you use the static call (which you probably do) so it's likely you'll end up with the same result but since you really want to waste time, I'm not going to stop you. When you decide to come back for more help, please be sure to bring a backtrace of the crash with you.
    is the backtrace the DSF disassembly on Eclipse for ubuntu?

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Replace QFileDialog

    Quote Originally Posted by ruben.rodrigues View Post
    is the backtrace the DSF disassembly on Eclipse for ubuntu?
    https://wiki.ubuntu.com/Backtrace
    http://en.wikipedia.org/wiki/Stack_trace
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  16. #16
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Replace QFileDialog

    I ran a debug and the only thing I got after the crash was this line:
    mi_cmd_var_create: Usage: NAME FRAME EXPRESSION.

    I also took a screenshot where the command that makes the crash is highlighted.

    thank you!


    Added after 4 minutes:


    backtrace with gdb as attachment because of characters limit.

    I still can't see much from the backtrace.
    Any help appreciated.
    Thank you! (also for telling me how to do the backtrace).

    Backtrace made with gdb as attachment.
    any help appreciated.
    thank you. (also for telling me how to do it.)
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by ruben.rodrigues; 24th January 2011 at 17:04.

  17. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Replace QFileDialog

    Please also provide output of "ldd libhalon.so" (or equivalent). You may have a conflict in one of gtk libraries. Qt has nothing to do with your situation.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  18. #18
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Replace QFileDialog

    rrodrigues@espLPT08:/opt/halcon/lib/x64-linux2.4-gcc40$ ldd libhalcon.so
    linux-vdso.so.1 => (0x00007fffd3b61000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f6c72254000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f6c71f4d000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f6c71d30000)
    librt.so.1 => /lib/librt.so.1 (0x00007f6c71b28000)
    libm.so.6 => /lib/libm.so.6 (0x00007f6c718a3000)
    libc.so.6 => /lib/libc.so.6 (0x00007f6c71530000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f6c7132c000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f6c71129000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f6c70f0c000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f6c73b45000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f6c70d07000)

    and

    rrodrigues@espLPT08:/opt/halcon/lib/x64-linux2.4-gcc40$ ldd libhalconcpp.so
    linux-vdso.so.1 => (0x00007fff2f9ff000)
    libhalcon.so => /opt/halcon/lib/x64-linux2.4-gcc40/libhalcon.so (0x00007f8660095000)
    libm.so.6 => /lib/libm.so.6 (0x00007f865fde9000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f865fad8000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f865f8c1000)
    libc.so.6 => /lib/libc.so.6 (0x00007f865f54f000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f865f34a000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f865f138000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f865ee31000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f865ec14000)
    librt.so.1 => /lib/librt.so.1 (0x00007f865ea0c000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f8661ce7000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f865e809000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f865e5ec000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f865e3e7000)

    I guess the problem is with the linux-vdso...how do I solve it?

    also sorry about the 1hour delay but I had to drive home.

  19. #19
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Replace QFileDialog

    No, I don't think that's the problem, see here: http://blogs.igalia.com/aperez/2009/...ux-gatevdsoso/

    Is your Qt compiled for 64 bits (use ldd on one of its libs)?

    By the way, please provide data (backtrace, ldd) for your minimal example and not your full-blown multithreaded project. I think your backtrace was from tha latter.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  20. #20
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Replace QFileDialog

    the lib I use is this:
    rrodrigues@espLPT08:/esp/IbexClientPlugin/plugins$ ldd libldiclient.so
    linux-vdso.so.1 => (0x00007fffa7490000)
    libhalconcpp.so => /opt/halcon/lib/x64-linux2.4-gcc40/libhalconcpp.so (0x00007fc51fab9000)
    libhalcon.so => /opt/halcon/lib/x64-linux2.4-gcc40/libhalcon.so (0x00007fc51e404000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007fc51e1d8000)
    libQtSql.so.4 => /usr/lib/libQtSql.so.4 (0x00007fc51df9a000)
    libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x00007fc51d3e6000)
    libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00007fc51cfae000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007fc51cd92000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fc51ca82000)
    libm.so.6 => /lib/libm.so.6 (0x00007fc51c7fc000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fc51c5e5000)
    libc.so.6 => /lib/libc.so.6 (0x00007fc51c273000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0x00007fc51c060000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fc51bd59000)
    librt.so.1 => /lib/librt.so.1 (0x00007fc51bb51000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fc5202d9000)
    libaudio.so.2 => /usr/lib/libaudio.so.2 (0x00007fc51b937000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00007fc51b710000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fc51b48a000)
    libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007fc51b243000)
    libSM.so.6 => /usr/lib/libSM.so.6 (0x00007fc51b03a000)
    libICE.so.6 => /usr/lib/libICE.so.6 (0x00007fc51ae1f000)
    libz.so.1 => /lib/libz.so.1 (0x00007fc51ac06000)
    libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fc51a941000)
    libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007fc51a737000)
    libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007fc51a504000)
    libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007fc51a2ff000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0x00007fc51a0fb000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007fc519edf000)
    libXt.so.6 => /usr/lib/libXt.so.6 (0x00007fc519c79000)
    libpcre.so.3 => /lib/libpcre.so.3 (0x00007fc519a48000)
    libuuid.so.1 => /lib/libuuid.so.1 (0x00007fc519843000)
    libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007fc519619000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007fc519413000)

    I also tried as an application with no plugins:

    rrodrigues@espLPT08:~/workspace/LDI_HMI$ ldd LDI_HMI
    linux-vdso.so.1 => (0x00007fff4cd1c000)
    libhalconcpp.so => /opt/halcon/lib/x64-linux2.4-gcc40/libhalconcpp.so (0x00007f33824c4000)
    libhalcon.so => /opt/halcon/lib/x64-linux2.4-gcc40/libhalcon.so (0x00007f3380e0f000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f3380c0b000)
    libQtSql.so.4 => /usr/lib/libQtSql.so.4 (0x00007f33809cd000)
    libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x00007f337fe19000)
    libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00007f337f9e2000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f337f7c6000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f337f4b6000)
    libm.so.6 => /lib/libm.so.6 (0x00007f337f231000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f337f01a000)
    libc.so.6 => /lib/libc.so.6 (0x00007f337eca8000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f337e9a1000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f337e78f000)
    librt.so.1 => /lib/librt.so.1 (0x00007f337e587000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f3382a5e000)
    libaudio.so.2 => /usr/lib/libaudio.so.2 (0x00007f337e36e000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00007f337e147000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f337dec1000)
    libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f337dc7b000)
    libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f337da72000)
    libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f337d857000)
    libz.so.1 => /lib/libz.so.1 (0x00007f337d63f000)
    libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f337d37a000)
    libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f337d170000)
    libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f337cf3e000)
    libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f337cd39000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f337cb1d000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f337c91a000)
    libXt.so.6 => /usr/lib/libXt.so.6 (0x00007f337c6b4000)
    libpcre.so.3 => /lib/libpcre.so.3 (0x00007f337c484000)
    libuuid.so.1 => /lib/libuuid.so.1 (0x00007f337c27f000)
    libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f337c055000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f337be50000)

Similar Threads

  1. Program Crash
    By jonmatteo in forum Qt Programming
    Replies: 5
    Last Post: 17th June 2009, 14:47
  2. Crash due to usage of QModelIndex inside QFileDialog?
    By mails.hemant in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2008, 09:23
  3. Replies: 2
    Last Post: 13th August 2008, 17:46
  4. Gnome makes application crash
    By regix in forum Qt Programming
    Replies: 35
    Last Post: 18th August 2006, 19:44
  5. Replies: 1
    Last Post: 20th January 2006, 12:01

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.