Results 1 to 6 of 6

Thread: Serious bug on dialog->isVisible (returns 1 but it is not visible!)

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Serious bug on dialog->isVisible (returns 1 but it is not visible!)

    That's the code:
    Qt Code:
    1. if(Screenshot->isVisible())
    2. { //we don't want duplicates of the screenshot dialog so point to the already visible
    3. system("echo 1 > /home/alex/Desktop/IF"); //I placed this to check from where it goes when it crashes
    4. Screenshot->raise();
    5. Screenshot->activateWindow();}
    6. else
    7. { //show the screenshot dialog
    8. system("echo 1 > /home/alex/Desktop/ELSE"); //I placed this to check from where it goes when it crashes
    9. Screenshot = new screenshot(this);
    10. Screenshot->exec();
    11. }
    To copy to clipboard, switch view to plain text mode 
    Sometimes this opens normally and some other times it crashes. I tried to find out what the problem was and i realized that when the program crashes Screenshot->isVisible() returns 1 and so goes to the "if" and that's why it crashes(it takes Screenshot->raise() but Screenshot dialog is not visible so it crashes)

    This is very serious. I am 100 % sure that the error is because of screenshot->isVisible() ( because as you see at the code I placed a system("echo 1 > /home/alex/Desktop/IF"); at the "if" occasion and a system("echo 1 > /home/alex/Desktop/ELSE"); at the "else" occassion and everytime the program crashed the IF file was appearing! so screenshot->isVisible() is quite buggy!). I know that we are told not to be against QT but I don't know how else to explain that Screenshot->isVisible() returns 1 while screenshot dialog is not visible. The most strange thing is that only 1/5 times the program crashes, the other times the screenshot dialog opens normally! So these 2 things forced me to believe that it is a QT bug.

    But in any occassion, any suggestion?


    Added after 10 minutes:


    And not only this. All of Screenshot->isEnabled() && Screenshot->isVisible() && Screenshot->isTopLevel() turn to be buggy and return 1 in this occassion
    Last edited by hakermania; 5th December 2010 at 13:03.
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Serious bug on dialog->isVisible (returns 1 but it is not visible!)

    Why don't you set Screenshot to NULL by default? That if it's not null you know you have created it so you can just use raise() and therefore no need for isVisible() (which I think just returns an interval variable - it has no idea if other windows are on top of your dialog)

    Unless of course I've just completely mis-interpreted your post.

  3. #3
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Serious bug on dialog->isVisible (returns 1 but it is not visible!)

    This could be a solution:
    Qt Code:
    1. if(screen_is_on) return;
    2. screen_is_on=1;
    3. Screenshot = new screenshot(this);
    4. Screenshot->exec();
    5. screen_is_on=0;
    To copy to clipboard, switch view to plain text mode 
    Except from if(screen_is_on) return; I can use if(screen_is_on){
    Screenshot->raise();
    Screenshot->activateWindow();
    }
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  4. #4
    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: Serious bug on dialog->isVisible (returns 1 but it is not visible!)

    Quote Originally Posted by hakermania View Post
    And not only this. All of Screenshot->isEnabled() && Screenshot->isVisible() && Screenshot->isTopLevel() turn to be buggy and return 1 in this occassion
    The common denominator of all this is the "Screenshot" object which is the one that is truly buggy. You are using an uninitialized variable so calling any method of the object will result in a crash.
    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.


  5. #5
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Serious bug on dialog->isVisible (returns 1 but it is not visible!)

    And how do you explain that this is happening 1/5 and not every time ?
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  6. #6
    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: Serious bug on dialog->isVisible (returns 1 but it is not visible!)

    Quote Originally Posted by hakermania View Post
    And how do you explain that this is happening 1/5 and not every time ?
    I won't even try explaining it, it's your task - take your source code, debugger and find out.
    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. Can't see widget, yet isVisible() returns true
    By MattPhillips in forum Qt Programming
    Replies: 1
    Last Post: 5th December 2010, 12:56
  2. closing child dialog closes parent dialog
    By sparticus_37 in forum Newbie
    Replies: 2
    Last Post: 28th May 2010, 19:46
  3. How to blur parent dialog when child dialog is displayed
    By abhilashajha in forum Qt Programming
    Replies: 4
    Last Post: 10th June 2009, 13:01
  4. problem with QFrame isVisible()
    By impeteperry in forum Qt Programming
    Replies: 1
    Last Post: 5th August 2008, 16:29
  5. app.exec() never returns?
    By stealth86 in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2007, 18:41

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.