That's the code:
if(Screenshot->isVisible())
{ //we don't want duplicates of the screenshot dialog so point to the already visible
system("echo 1 > /home/alex/Desktop/IF"); //I placed this to check from where it goes when it crashes
Screenshot->raise();
Screenshot->activateWindow();}
else
{ //show the screenshot dialog
system("echo 1 > /home/alex/Desktop/ELSE"); //I placed this to check from where it goes when it crashes
Screenshot = new screenshot(this);
Screenshot->exec();
}
if(Screenshot->isVisible())
{ //we don't want duplicates of the screenshot dialog so point to the already visible
system("echo 1 > /home/alex/Desktop/IF"); //I placed this to check from where it goes when it crashes
Screenshot->raise();
Screenshot->activateWindow();}
else
{ //show the screenshot dialog
system("echo 1 > /home/alex/Desktop/ELSE"); //I placed this to check from where it goes when it crashes
Screenshot = new screenshot(this);
Screenshot->exec();
}
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
Bookmarks