Click here to Skip to main content
16,016,770 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Prevent CDialog activation. Pin
mintguy11-Aug-05 20:21
mintguy11-Aug-05 20:21 
GeneralRe: Prevent CDialog activation. Pin
ThatsAlok11-Aug-05 20:34
ThatsAlok11-Aug-05 20:34 
GeneralRe: Prevent CDialog activation. Pin
mintguy11-Aug-05 20:56
mintguy11-Aug-05 20:56 
GeneralRe: Prevent CDialog activation. Pin
ThatsAlok11-Aug-05 22:45
ThatsAlok11-Aug-05 22:45 
GeneralRe: Prevent CDialog activation. Pin
mintguy11-Aug-05 20:23
mintguy11-Aug-05 20:23 
GeneralRe: Prevent CDialog activation. Pin
Jose Lamas Rios11-Aug-05 20:46
Jose Lamas Rios11-Aug-05 20:46 
GeneralRe: Prevent CDialog activation. Pin
mintguy11-Aug-05 20:54
mintguy11-Aug-05 20:54 
GeneralApplication crash due to change in compiler settings Pin
ComplexLifeForm11-Aug-05 10:01
ComplexLifeForm11-Aug-05 10:01 
Hi,

I am currently working on a legacy MultiThreaded MFC application which talks to the remote hardware over a network. The application is compiled with VC++ 6.0 SP5 and has many dlls (Regular, Extension, C++ and WIN32). Now here is a typical user scenarion

1. The user starts a wizard to generate a report for a particular parameter usage on the remote hardware.
2. Configures the report parameters through wizard walkthrough and creates a task that will send some commands to the remote hardware and fetch the required data. The task is executed immidiately.

Now here is a problem I faced during the recent Release build for internal testing due to accidental change in compiler settings.
The application was originally configured to compile with optimization set to "complie for speed" for the Release builds.

When the binary created with this setting is executed, the application runs perfectly fine. The user starts the wizard configure parameters create and execute the task. The application fetches the required data and generates the report.

Now if the compiler setting is changed to optimization=disable with rest every thing remaining same, the application crashes with bad memory reference during the task execution.

During a task execution there may be 3 to 5 threads (worker + GUI) running depending on the complexity of the requested task.

I did found out that the crash was due to invalid thread handle value for one of the threads by attaching the VC debugger externally (On running the release build of the application from within the VC debugger, it works perfectly fine, strange !!!???). Breakpoints are not helping as it seems that they introduces enough time delay for the thread handle to be valid.

I am not too sure on whether the handle is getting invalid either due to not getting initialized at all (the thread is created externally and then set as a reference in class object) or getting terminated too soon.

Well guys I really need help on this as I have been struggling with it for 2-3 days and it is driving me nuts !!

1. I will really like to know what caused the problem at the first place ?
2. What really happened when optimization is turned off that lead to application crash.

I tried to solve this problem by
1. Introducing external delays using loops which didn't help
2. Making the thread switch context by introducing Sleep(0) which did seems to solve the problem (Why?) for this wizard but it crashed another one (again a mistery to me !!)
3. By using Event synchronization object. I create a auto reset event with initial state set as non-signalled. After the thread internal parameters are initialized and before execute method is called I call SetEvent() to set the state to signalled, the application is working perfectly fine with optimization disabled. Interestingly if I simply turnon the optimization for speed without making any code changes everything works fine again !!
In the main execute method I wait for the event to get signalled before proceeding by using WaitForSingleObject(EventHandle, 500), I do get out of the wait but not due to event getting signalled but due to WaitTimeOut happening (don't know why the timeout is happening when the wait should have been over due to event signalling), INFINITE timeout hangs the application.

So please if anyone has a clue on what is going on here please let me know asap.

Sorry if the problem description is bit too long.

Thanks in Advance.

Regards
GeneralRe: Application crash due to change in compiler settings Pin
geo_m13-Aug-05 21:58
geo_m13-Aug-05 21:58 
GeneralWaiting for a command to complete Pin
jet91511-Aug-05 8:46
jet91511-Aug-05 8:46 
GeneralRe: Waiting for a command to complete Pin
David Crow11-Aug-05 9:01
David Crow11-Aug-05 9:01 
GeneralRe: Waiting for a command to complete Pin
Garth J Lancaster11-Aug-05 12:34
professionalGarth J Lancaster11-Aug-05 12:34 
Generalneed help with windbg Pin
valerie9911-Aug-05 7:45
valerie9911-Aug-05 7:45 
GeneralRe: need help with windbg Pin
David Crow11-Aug-05 8:15
David Crow11-Aug-05 8:15 
GeneralRe: need help with windbg Pin
valerie9911-Aug-05 8:50
valerie9911-Aug-05 8:50 
Generalmnemonic access key and tabstop = false Pin
23_44411-Aug-05 7:38
23_44411-Aug-05 7:38 
GeneralRe: mnemonic access key and tabstop = false Pin
David Crow11-Aug-05 8:18
David Crow11-Aug-05 8:18 
GeneralRe: mnemonic access key and tabstop = false Pin
23_44411-Aug-05 8:30
23_44411-Aug-05 8:30 
GeneralRe: mnemonic access key and tabstop = false Pin
23_44411-Aug-05 8:52
23_44411-Aug-05 8:52 
Generalhelp me -> menu Pin
Anonymous11-Aug-05 4:33
Anonymous11-Aug-05 4:33 
GeneralRe: help me -> menu Pin
Cedric Moonen11-Aug-05 4:37
Cedric Moonen11-Aug-05 4:37 
GeneralRe: help me -> menu Pin
toxcct11-Aug-05 5:35
toxcct11-Aug-05 5:35 
Generalprinting a vector Pin
Eytukan11-Aug-05 4:13
Eytukan11-Aug-05 4:13 
GeneralRe: printing a vector Pin
Cedric Moonen11-Aug-05 4:25
Cedric Moonen11-Aug-05 4:25 
GeneralRe: printing a vector Pin
Eytukan11-Aug-05 4:37
Eytukan11-Aug-05 4:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.