Results 1 to 3 of 3

Thread: AboutToHide, why isn't it a race condition?

  1. #1
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default AboutToHide, why isn't it a race condition?

    [Disclaimer: I assume that Signals/Slots are asynchronous (or is this not the default?) I know you *can* make them asynchronous..]

    Either way, it would seem the "AboutToHide" signal and their ilk (AboutToShow, others?) would signal any classes listening and if they didn't respond fast enough they'd miss their chance. That said, I've never had any issues using this signal or similar ones.

    What am I missing? Is this just a race condition with an acceptably low chance of missing the object before it closes/opens? Is there some code produced that waits for code blocks utilizing AboutToHide-style signals to reach their end before closing the Dialog/Menu/whatever?

    Thank you for any help/discussion

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: AboutToHide, why isn't it a race condition?

    they are synchronous by default unless a signal/slot jumps a thread
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    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: AboutToHide, why isn't it a race condition?

    Quote Originally Posted by tescrin View Post
    [Disclaimer: I assume that Signals/Slots are asynchronous (or is this not the default?) I know you *can* make them asynchronous..]

    Either way, it would seem the "AboutToHide" signal and their ilk (AboutToShow, others?) would signal any classes listening and if they didn't respond fast enough they'd miss their chance.
    Only if you deliberately shoot yourself in your foot by making connections to those signals queued (which doesn't make sense in this particular case).
    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.


Similar Threads

  1. Replies: 9
    Last Post: 5th July 2012, 21:16
  2. Replies: 0
    Last Post: 11th December 2011, 22:51
  3. Replies: 0
    Last Post: 29th October 2010, 01:16
  4. problem with aboutToHide signal on QMenu
    By eric_vi in forum Qt Programming
    Replies: 2
    Last Post: 20th September 2010, 17:05
  5. 2D Race Car collision detection
    By neonnds in forum Qt Programming
    Replies: 0
    Last Post: 6th July 2008, 08:10

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.