|
|
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Problem with dialogs
Problem with dialogs [message #47032] |
Mon, 14 November 2016 11:41 |
|
koldo
Messages: 3398 Registered: August 2008
|
Senior Veteran |
|
|
Lately (from weeks or few months) I am having problems with dialogs. Without any apparent reason and not always, they crash the program when closing them.
For example this function called from a THISBACK after clicking a button, may crash in the destructor:
void ScatterCtrl::DoProcessing()
{
ProcessingDlg(*this).Run(true);
}
It is also happening many times with FileSel.
It seems it happens when the dialog constructor is inside a function, like here:
void Function_called_by_a_THISBACK() {
FileSel fs;
// Do something
// FileSel crashes in its destructor when going out of the function
}
Am I doing anything wrong?
Best regards
Iñaki
|
|
|
|
|
|
|
|
|
|
|
Re: Problem with dialogs [message #47087 is a reply to message #47084] |
Wed, 30 November 2016 10:37 |
|
koldo wrote on Wed, 30 November 2016 09:15Thank you Mirek, I understand. Stack overwriting could be the culprit.
Do you know if is there an easy way to check problems in the stack?
Hi Koldo,
You can run the code in Valgrind It is slow, but can help with all kinds of invalid memory access problems. There is also some limited support in TheIDE (at least on linux).
Best regards,
Honza
|
|
|
Re: Problem with dialogs [message #47089 is a reply to message #47087] |
Thu, 01 December 2016 09:03 |
|
koldo
Messages: 3398 Registered: August 2008
|
Senior Veteran |
|
|
Thank you!
I will try both sides. Valgrind is only for Linux but there are other Windows counterparts.
The reason I imagine follows this sequence:
- A thread declares a C array
- A dialog is declared and opened
- The thread goes out of the bounds smashing dialog memory
- The dialog is closed and crashes in the destructor
This way, although both the thread and the dialog are unrelated, the thread smashes dialog memory.
It is curious that this only happens to very unrelated TopWindow subclasses. Maybe it is simply because TopWindow uses much memory and so the probability of being crashed is higher.
Best regards
Iñaki
[Updated on: Thu, 01 December 2016 09:03] Report message to a moderator
|
|
|
|
Re: Problem with dialogs [message #47092 is a reply to message #47090] |
Fri, 02 December 2016 08:54 |
|
koldo
Messages: 3398 Registered: August 2008
|
Senior Veteran |
|
|
Uuups. Threads have their own stack!.
Linker has /STACK:20000000 (> 8000000)
The application is 32 bits. Exe. size in debug mode is 36 Mb.
Best regards
Iñaki
|
|
|
Goto Forum:
Current Time: Tue Nov 05 14:09:40 CET 2024
Total time taken to generate the page: 0.01803 seconds
|
|
|