try
connect(ui.tlbclose,SIGNAL(clicked(bool)),mdi,SLOT (close(void)));
connect returns bool that is true if connection was successfull.
And improper connects generates also messages (output window of visual studio)
try
connect(ui.tlbclose,SIGNAL(clicked(bool)),mdi,SLOT (close(void)));
connect returns bool that is true if connection was successfull.
And improper connects generates also messages (output window of visual studio)
See GrEEn (Graphics Effects Environment)
http://sourceforge.net/project/platf...roup_id=232746
a qt-based plugins oriented MDI image processing application(contains also qt plugins like styles & imageformats).
Raccoon29 (19th May 2008)
wysota, you are right.We're just guessing here. If we can't reproduce a bug, how can we solve it? You are the one having access to the buggy code [...]
Ok, guessing is over.
Today I "lost" my morning, but now I have the essential code to reproduce the bug, I attach it here.
Environment
Qt: v 4.3.4
OS: Windows Xp Professional
Compiler: MinGW make 3.80 (mingw32-make)
Qmake: v 2.01a
How to reproduce the bug
From the program start:
1) Menu: Anagraph->Article managing
2) Click on "New" button
3) Position the cursor on a short field below and press F4
4) Close the appeared window by "Close" button (not the X)
5) Close the "Article data" window by "Close" button (not the X)
now the program should exit unexpectedly.
If between points 4 and 5 you give focus to an underneat window (or to another program), the program will not exit and will close the "Article data" window normally (the infamous focus trick).
So, what to say... have a nice debugging
I want to thank you all very much for being still giving help to me, even in a so desperate situation... I'm touched , no other forum gives so much!
--
raccoon29
"La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "
Hmm... It seems I am unable to reproduce the bug with Qt 4.4. Which version of Qt are you using? Qt 4.3.4 indeed segfaults. The reason is probably that you destroy a window that contains a button that is currently the source of an emitted signal. Calling deleteLater() instead of deleting the object immediately might be enough to overcome the problem. I'm not sure what your "viewport" does, though, so the problem might be completely elsewhere. Based on what the debugger says, the crash happens while the click on the button is being handled. Taking a look at QMdiSubWindow::closeEvent() and QMdiArea::viewportEvent() might reveal the exact cause.
Raccoon29 (19th May 2008)
Uhm, I see.It seems I am unable to reproduce the bug with Qt 4.4. Which version of Qt are you using? Qt 4.3.4 indeed segfaults.
So, does it mean that upgrading to Qt4.4 fixes the problem? (As I wrote, mine is Qt 4.3.4)
But I don't delete it, I leave this task to the WA_DeleteOnClose...Calling deleteLater() instead of deleting the object immediately might be enough to overcome the problem.
"viewport" is nothing special, it just wraps the opening/closing of the mdisubwindows, and several other not dangerous functions (hidden in the debug version I sent you).I'm not sure what your "viewport" does, though, so the problem might be completely elsewhere.
Last edited by Raccoon29; 19th May 2008 at 15:04. Reason: updated contents
--
raccoon29
"La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "
I can't believe it! Finally we solved it!
touched...
What I did to solve it:
1_ I forced off the automated desctruction disabling WA_DeleteOnClose
Qt Code:
{ [...] wArticle->setAttribute(Qt::WA_DeleteOnClose,false); //forced off for every widget [...] }To copy to clipboard, switch view to plain text mode
2_ CViewports desctructor uses deleteLater() instead of delete for every widget,ensures that every widget is destroyed in the right way:
Qt Code:
if(pArticle) { //delete pArticle; pArticle->deleteLater(); pArticle=NULL; wArticle=NULL; }To copy to clipboard, switch view to plain text mode
3_ Every closeEvent (of every widget) calls its destruction with deleteLater(), instead to delegate it to WA_DeleteOnClose:
Qt Code:
{ if(!maybeSave()) { event->ignore(); return; } viewport->close(CustomerOrder); //event->accept(); -> no more relies on WA_DeleteOnClose deleteLater(); // calls its destruction }To copy to clipboard, switch view to plain text mode
And in this way it is working (at least until now).
After N posts we finally found the solution, this forum is simply great.
Thank you from deep my heart to everyone!
By the way: wysota, you gave me the main tip to solve it (with deleteLater), and since you answered kindly to my (I admit) boring request, from now on, I'll call you SaintWysota (or shorted S.wysota)
--
raccoon29
"La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "
Oh, I am not saint
As for your problem - it must have been related to the signal emission I mentioned.
Bookmarks