Jump to content


Photo

Crash on Windows shutdown


  • Please log in to reply
14 replies to this topic

#1 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 23 August 2010 - 05:37 PM

Boki,

it seems that I tracked down a bug in my app that is caused by the NextGrid component.

Simple to reproduce:

1. Create a new project
2. Place a TNextGrid component onto the form (no columns or other changes are required)
3. Build the project
4. Start the project
5. Shut down windows

This produces a crash here (Seven and XP). A normal program exit by clicking the X button works fine.

Using D2009 and the latest NextGrid version.

Is this something you can reproduce? I think NextInspector has probably the same problem.

#2 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 23 August 2010 - 06:01 PM

One more find: It seems to happen only if Application.ProcessMessages is set to TRUE. If it is FALSE, then this crash doesn't happen.

#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 23 August 2010 - 08:32 PM

Hello Aim,

I have just test it and all worked fine.

Can you please attach here your exe file of project to I test it again. Also, can you please tell me which error you get. Thank you.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 23 August 2010 - 08:33 PM

Hello Aim,

Update: Can you please send me a source of application to I test it again.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 23 August 2010 - 11:08 PM

I have attached the project (EXE + Source).

Here is the error log (occurs only with Application.MainFormOnTaskbar := True):

CODE
exception class   : EAccessViolation
exception message : Access violation at address 004B51CF in module 'Project1.exe'. Read of address 00000008.

main thread ($fd0):
004b51cf +003 Project1.exe Forms                        TGlassFrame.FrameExtended
004ae42f +0d7 Project1.exe Forms                        TCustomForm.WMWindowPosChanging
00493db2 +2d2 Project1.exe Controls                     TControl.WndProc
004981eb +513 Project1.exe Controls                     TWinControl.WndProc
004aac58 +594 Project1.exe Forms                        TCustomForm.WndProc
00497904 +02c Project1.exe Controls                     TWinControl.MainWndProc
004741f4 +014 Project1.exe Classes                      StdWndProc
7c91e450 +010 ntdll.dll                                 KiUserCallbackDispatcher
7e39f403 +00d USER32.dll                                SetMenu
004abbda +192 Project1.exe Forms                        TCustomForm.SetMenu
004ada5f +01b Project1.exe Forms                        TCustomForm.WMNCCreate
00493db2 +2d2 Project1.exe Controls                     TControl.WndProc
004981eb +513 Project1.exe Controls                     TWinControl.WndProc
004aac58 +594 Project1.exe Forms                        TCustomForm.WndProc
00497904 +02c Project1.exe Controls                     TWinControl.MainWndProc
004741f4 +014 Project1.exe Classes                      StdWndProc
7c91e450 +010 ntdll.dll                                 KiUserCallbackDispatcher
7e37d0d1 +02e USER32.dll                                CreateWindowExW
0040a22f +03f Project1.exe Windows                      CreateWindowEx
00497028 +030 Project1.exe Controls                     TWinControl.CreateWindowHandle
004acc24 +0fc Project1.exe Forms                        TCustomForm.CreateWindowHandle
00496f45 +139 Project1.exe Controls                     TWinControl.CreateWnd
004a8d59 +005 Project1.exe Forms                        TScrollingWinControl.CreateWnd
004ac936 +00a Project1.exe Forms                        TCustomForm.CreateWnd
0049734e +016 Project1.exe Controls                     TWinControl.CreateHandle
0049ae98 +01c Project1.exe Controls                     TWinControl.HandleNeeded
0049aea5 +005 Project1.exe Controls                     TWinControl.GetHandle
004b1e09 +02d Project1.exe Forms                        GetTopMostWindows
7e37a5bf +011 USER32.dll                                EnumWindows
004b1ebd +02d Project1.exe Forms                        TApplication.DoNormalizeTopMosts
004b1f92 +002 Project1.exe Forms                        TApplication.NormalizeTopMosts
004b278d +315 Project1.exe Forms                        TApplication.WndProc
004741f4 +014 Project1.exe Classes                      StdWndProc
7c91e450 +010 ntdll.dll                                 KiUserCallbackDispatcher
0049577f +05f Project1.exe Controls                     TWinControl.Destroy
0049cf01 +01d Project1.exe Controls                     TCustomControl.Destroy
00404150 +008 Project1.exe System              2451  +0 TObject.Free
004b91dd +011 Project1.exe NxScrollControl      933  +1 TNxScrollControl.Destroy
004be81f +0d3 Project1.exe NxCustomGridControl  729 +12 TNxCustomGridControl.Destroy
004c7280 +074 Project1.exe NxCustomGrid         329  +8 TNxCustomGrid.Destroy
004d011d +025 Project1.exe NxGrid               145  +2 TNextGrid.Destroy
004957ad +08d Project1.exe Controls                     TWinControl.Destroy
004a8d30 +028 Project1.exe Forms                        TScrollingWinControl.Destroy
004a99e9 +0f9 Project1.exe Forms                        TCustomForm.Destroy
004733ef +047 Project1.exe Classes                      TComponent.DestroyComponents
004a7b71 +035 Project1.exe Forms                        DoneApplication
00458876 +026 Project1.exe SysUtils                     DoExitProc
00405275 +065 Project1.exe System              2451  +0 @Halt0
004b287d +405 Project1.exe Forms                        TApplication.WndProc
004741f4 +014 Project1.exe Classes                      StdWndProc
7c91e450 +010 ntdll.dll                                 KiUserCallbackDispatcher
7e378d72 +052 USER32.dll                                DefWindowProcW
7e37a034 +016 USER32.dll                                CallWindowProcW
004982e7 +0d7 Project1.exe Controls                     TWinControl.DefaultHandler
00493db2 +2d2 Project1.exe Controls                     TControl.WndProc
004981eb +513 Project1.exe Controls                     TWinControl.WndProc
00497904 +02c Project1.exe Controls                     TWinControl.MainWndProc
004741f4 +014 Project1.exe Classes                      StdWndProc
7c91e450 +010 ntdll.dll                                 KiUserCallbackDispatcher

Attached Files



#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 23 August 2010 - 11:38 PM

Hello Aim,

Thank you, now I receive AV with exe file. Can you please tell me where do you place ProcessMessages in source code, because you didn't add it in demo smile.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 23 August 2010 - 11:42 PM

QUOTE
Can you please tell me where do you place ProcessMessages in source code, because you didn't add it in demo


The EXE is from the sources that are included in the ZIP, I have nowhere added ProcessMessages.

Do you not get this crash when you compile the included sources with D2009?

#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 24 August 2010 - 12:10 AM

Hello Aim,

I don't get AV when I compile demo, only when I run your exe.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#9 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 24 August 2010 - 12:20 AM

QUOTE
I don't get AV when I compile demo, only when I run your exe.


Which Delphi version do you use?

#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 24 August 2010 - 12:31 AM

Hello Aim,

I have compile it with D2009 and I have test it in Virtual Machine.

You have mentioned that bug happen when you use ProcessMessages. Is this must be used in project?

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#11 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 24 August 2010 - 12:51 AM

QUOTE
You have mentioned that bug happen when you use ProcessMessages. Is this must be used in project?


Ouch, sorry. This was a wrong information, I meant " Application.MainFormOnTaskbar := True" instead of "Application.ProcessMessages". Sorry.

In the meantime I figured out that this seems to be a bug in the D2009 VCL. It does not happen in D2010.

In D2010, the VCL performs more actions in TApplication.WndProc (and "WM_ENDSESSION") than in D2009. I have now tweaked my D2009 VCL and this crash no longer happens in combination with TNextGrid...

#12 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 24 August 2010 - 12:56 AM

Hello Aim,

No problem smile.gif

I hope that this solution will work good. I really not see why it show AV on FRollShadow.Free. I have check it now once again, and there is nothing suspicious in code.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#13 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 24 August 2010 - 01:04 AM

D2010 VCL also performs a Application.Terminate on windows shutdown and doesn't call Destroy then while this method is called in D2009. That's the main difference that caused this problem. It didn't cause a problem with other components I use, but TNextGrid was affected. Glad that I could fix this now...

#14 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 24 August 2010 - 01:06 AM

Hello Aim,

Maybe we also have a different versions of Delphi because in my case (when I compile project) bug doesn't appear. It may be that it is fixed in my version.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#15 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 24 August 2010 - 01:12 PM

QUOTE
Maybe we also have a different versions of Delphi because in my case (when I compile project) bug doesn't appear. It may be that it is fixed in my version.


Strange that you cannot reproduce this.

I have original D2009 and D2010, both with all updates installed. Comparing the VCL shows that they have changed/fixed some code for WM_ENDSESSION.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users