Results 1 to 5 of 5

Thread: QApplication::exec crashing while running a multithreaded application

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2008
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QApplication::exec crashing while running a multithreaded application

    Thanks.
    Can you please tell me what I need to check corresponding to threads.
    Since the product was working perfectly fine in Qt3.x( I have verified that) I am at a loss as to what I need to check.
    Sometimes I get in Qt4 (which I did not get in Qt3]
    QPixmap:it is not safe to use pixmap outside GUI thread, so it probably points to some threading issue

    One thing I wanted to notify is, we were also using QApplication::lock() in our code but since Qt4 has made QApplication::lock() obsolete, I used QMutex mutex(QMutex::Recursive) [lock/unlock] function
    The reason for using Recursive was sometimes the code has a lock inside a lock [and as told was working in Qt3]

    LOCK: //QApplication::lock
    funcA();
    UNLOCK;

    funcA(){
    LOCK:
    ...
    UNLOCK:

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

    Default Re: QApplication::exec crashing while running a multithreaded application

    Unfortunately its not something anyone who does not know the code can answer.
    You have to read the Qt documentation in respect to the changes done between Qt3 and Qt4.
    Threading was redone extensively in Qt4, and you really should read the threading section in Qt4 docs.
    When you know how threading in Qt4 works, you might attempt to rewrite the old Qt3 code so that it will conform to Qt4.
    http://doc.trolltech.com/4.4/threads.html

    I also would think, you should not hope to finish such a task in one afternoon, for a "real" application.
    ==========================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.

  3. #3
    Join Date
    Nov 2008
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QApplication::exec crashing while running a multithreaded application

    I have taken a look at the threading tutorial but I don't think I am doing anything that is prohibited.
    Since the product follows a Java multithreaded AWT model, whereby the main AWT Java thread [actually linux posix thread as I am testing in linux-x86] is what will be making GUI calls and then there is an eventThread [another Java thread] which will initialize [create QApplication, does show() and exec()]. The main AWT thread will draw in the QImage backbuffer and the paintEvent() call will flush the QImage into QPaintDevice. This is the logic that I wanted to follow in Qt4
    But, in Qt4 calls I am not sure why I am getting the crash as described above as soon as I call exec(). sm_performSaveYourself is a QT function which I don't have control on and so I am not sure why it will create a QString with wrong address [thereby creating segv]. Also, libSM.so and libICE.so are system lib I presume so there also I do not have a control

    I also have checked my mutex logic. I am using QMutex and I have seen that if I use it wrongly, it shows deadlock from QMutex class. But I am not seeing any such problem in our product. Is there anyone who has seen this kind of crash and know about a possible solution or an area where to investigate?
    I can send the code to anyone who is interested.
    I am really stuck with this crash. PLease suggest some remedy

Similar Threads

  1. application freezes without crashing (and closing)
    By nass in forum Qt Programming
    Replies: 15
    Last Post: 25th September 2007, 12:21

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.