Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
CodeStatistics window doesn't really close?
kkez:
There's a problem with the CodeStats window. If you execute this plugin one or two times and then look at a list of open windows like the one you can get using winspy++, you'll see that it's still open, but invisible and no longer "modal".
It should be a problem with the dialog not being modal when created, and the use of EndModal when you close it. I'm not familiar with wxwidgets so i don't know what to use instead of EndModal :)
Game_Ender:
By default when you create no modal dialogs in wxWidgets clicking the close button or hitting ok/cancel only hides them. This lets you reshow them without having to recreate them every time. You should be able to capture the close event or the click event and destroy the dialog.
kkez:
--- Quote from: Game_Ender on July 15, 2006, 10:53:20 pm ---This lets you reshow them without having to recreate them every time.
--- End quote ---
But the point is that CodeStats keeps creating new windows without destroying or reusing them.
Pecan:
--- Quote from: kkez on July 16, 2006, 04:28:30 pm ---
--- Quote from: Game_Ender on July 15, 2006, 10:53:20 pm ---This lets you reshow them without having to recreate them every time.
--- End quote ---
But the point is that CodeStats keeps creating new windows without destroying or reusing them.
--- End quote ---
Yes, you are right. CodeStat is missing a dlg->Destroy() after it's EndModal();
I will submit a patch.
Thanks
pecan
If you want to fix it yourself, here's a patch
--- Code: ---Index: codestat.cpp
===================================================================
--- codestat.cpp (revision 2750)
+++ codestat.cpp (working copy)
@@ -100,13 +100,14 @@
return -1;
}
+ int dlgReturnCode = 0; //(pecan 2006/7/16)
dlg = new CodeStatExecDlg(Manager::Get()->GetAppWindow());
// Load the language settings and launch the main function
LanguageDef languages[NB_FILETYPES_MAX];
int nb_languages = LoadSettings(languages);
if(dlg->Execute(languages,nb_languages) != 0)
- return -1;
-
- return 0;
+ dlgReturnCode = -1; //(pecan 2006/7/16)
+ dlg->Destroy(); //(pecan 2006/7/16)
+ return dlgReturnCode; //(pecan 2006/7/16)
}
--- End code ---
Game_Ender:
--- Quote from: Game_Ender on July 15, 2006, 10:53:20 pm ---You should be able to capture the close event or the click event and destroy the dialog.
--- End quote ---
That was the key line to my post.
Navigation
[0] Message Index
[#] Next page
Go to full version