Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #9597 > unrolled thread

Tab control with Splitwindow: crash when pushbutton is clicked

Started byKees Bouw <kees@ic2.com>
First post2016-08-10 17:23 +0200
Last post2016-08-11 14:55 +0100
Articles 9 — 6 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Tab control with Splitwindow: crash when pushbutton is clicked Kees Bouw <kees@ic2.com> - 2016-08-10 17:23 +0200
    Re: Tab control with Splitwindow: crash when pushbutton is clicked Robert van der Hulst <rjvanderhulst@gmail.com> - 2016-08-10 09:13 -0700
      Re: Tab control with Splitwindow: crash when pushbutton is clicked Carlos Rocha <j.carlos.rocha.1.SpyedBy@gmail.com> - 2016-08-10 18:24 +0100
      Re: Tab control with Splitwindow: crash when pushbutton is clicked D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2016-08-11 11:40 +0200
        Re: Tab control with Splitwindow: crash when pushbutton is clicked Robert van der Hulst <robert@xsharp.eu> - 2016-08-12 15:24 +0200
      Re: Tab control with Splitwindow: crash when pushbutton is clicked Kees Bouw <kees@ic2.com> - 2016-08-15 15:55 +0200
        Re: Tab control with Splitwindow: crash when pushbutton is clicked Robert van der Hulst <rjvanderhulst@gmail.com> - 2016-08-15 07:50 -0700
          Re: Tab control with Splitwindow: crash when pushbutton is clicked Kees Bouw <kees@ic2.com> - 2016-11-17 10:57 +0100
    Re: Tab control with Splitwindow: crash when pushbutton is clicked Martin <Martin@spam.spam> - 2016-08-11 14:55 +0100

#9597 — Tab control with Splitwindow: crash when pushbutton is clicked

FromKees Bouw <kees@ic2.com>
Date2016-08-10 17:23 +0200
SubjectTab control with Splitwindow: crash when pushbutton is clicked
Message-ID<enhmqbhfqve4pq256jmnjop5nudeean2ct@4ax.com>
Hi,

We use tab controls to display e-mails.
Each tab is a splitwindow; on one of the panes there is a pushbutton to display attachments.
When there is more than one tab opened, clicking on this pushbutton totally crashes the entire application.
The only way to end it is by using task manager.
It seems impossible to debug because clicking on the button immediately crashes the application
(turns white, no response) and the underlying code is never reached.
Does anyone know of a possible cause, or how to find a cause (debugging?) in this situation?
Thanks a lot in advance!

Kees Bouw.

[toc] | [next] | [standalone]


#9600

FromRobert van der Hulst <rjvanderhulst@gmail.com>
Date2016-08-10 09:13 -0700
Message-ID<f5693dc2-8353-4d4f-9a90-b6a25adcc1b5@googlegroups.com>
In reply to#9597
Kees,
This what I would do:
- Start Visual Studio
- Start your app and navigate to the place where you can reproduce the error
- Attach the Debugger in VS to your app (Debug, Attach, in Native mode)
- Tell it to break on all Win32 and C++ Exceptions (Debug, Window, Exception settings)
- Go to your app and press the tabkey.
Then two things can happen:
- your app generates an exception and VS breaks
- your app freezes. In that case goto VS and choose Debug-Break All

If you now look at the Debugger-CallStack window you will at least have an idea in which piece of your code the error appears. You will not see source code, but you will be able to see the disassembled code, which may give you a clue about what is happening.


Robert



> Hi,
> 
> We use tab controls to display e-mails.
> Each tab is a splitwindow; on one of the panes there is a pushbutton to display attachments.
> When there is more than one tab opened, clicking on this pushbutton totally crashes the entire application.
> The only way to end it is by using task manager.
> It seems impossible to debug because clicking on the button immediately crashes the application
> (turns white, no response) and the underlying code is never reached.
> Does anyone know of a possible cause, or how to find a cause (debugging?) in this situation?
> Thanks a lot in advance!
> 
> Kees Bouw.

[toc] | [prev] | [next] | [standalone]


#9601

FromCarlos Rocha <j.carlos.rocha.1.SpyedBy@gmail.com>
Date2016-08-10 18:24 +0100
Message-ID<nofo1h$866$1@dont-email.me>
In reply to#9600
Às 17:13 de 10/08/2016, Robert van der Hulst escreveu:
> Kees,
> This what I would do:
> - Start Visual Studio
> - Start your app and navigate to the place where you can reproduce the error
> - Attach the Debugger in VS to your app (Debug, Attach, in Native mode)
> - Tell it to break on all Win32 and C++ Exceptions (Debug, Window, Exception settings)
> - Go to your app and press the tabkey.
> Then two things can happen:
> - your app generates an exception and VS breaks
> - your app freezes. In that case goto VS and choose Debug-Break All
>
> If you now look at the Debugger-CallStack window you will at least have an idea in which piece of your code the error appears. You will not see source code, but you will be able to see the disassembled code, which may give you a clue about what is happening.
>

Wow. This is new for me if it's about VO.
Which version of VS allows this?

-- 
*Carlos Rocha*

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

[toc] | [prev] | [next] | [standalone]


#9604

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2016-08-11 11:40 +0200
Message-ID<ivhoqbtupi2g3sdpicn27e6bn2sf85b0qc@4ax.com>
In reply to#9600
Replying on message of Wed, 10 Aug 2016 09:13:59 -0700 (PDT) from
Robert van der Hulst:


 Hello Robert,

>Kees,
>This what I would do:
>- Start Visual Studio

The problem is in a VO program - is this working for a VO program? In
that case, how to we attach the VS debugger to a VO program?

Dick

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#9609

FromRobert van der Hulst <robert@xsharp.eu>
Date2016-08-12 15:24 +0200
Message-ID<nokpmp.2cg.1@xsharp.info>
In reply to#9604
Dick,
Yes this works with VO too. You will not see your source and the call 
stack may be confusing, but if you tell the linker to produce a MAP file 
along with your exe or dll you may be able to understand what is happening,

Robert

> Replying on message of Wed, 10 59 -0700 (PDT) from
> Robert van der Hulst:
>
>
>  Hello Robert,
>
>> Kees,
>> This what I would do:
>> - Start Visual Studio
>
> The problem is in a VO program - is this working for a VO program? In
> that case, how to we attach the VS debugger to a VO program?
>
> Dick
>
> --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
>

[toc] | [prev] | [next] | [standalone]


#9612

FromKees Bouw <kees@ic2.com>
Date2016-08-15 15:55 +0200
Message-ID<lqh3rbljhros1pbsjlmudd2276nqnamuhg@4ax.com>
In reply to#9600
Hi Robert,

Thank you for this information. I had no idea that you can debug VO code with VS.
I followed the steps and what happens is that of the two possibilities the app freezes.
Then I do a Break-all as you said and then Visual Studio tries to find a file called VO28run.pdb, which I do not
have (I do have vo28run.map but I guess VS can't work with that). This contains symbols and debug information.
So it seems that it breaks in VO28run.dll but VS can't say where exactly because there are no symbols loaded.

The call stack is this:

>	user32.dll!RealDefWindowProcA()	Unknown
 	user32.dll!DefWindowProcA()	Unknown
 	VO28Gui.dll!0388a346()	Unknown
 	[Frames below may be incorrect and/or missing, no symbols loaded for VO28Gui.dll]	
 	user32.dll!__InternalCallWinProc@20()	Unknown
 	user32.dll!UserCallWinProcCheckWow()	Unknown
 	user32.dll!SendMessageWorker()	Unknown
 	user32.dll!SendMessageW()	Unknown
 	user32.dll!xxxRemoveDefaultButton()	Unknown
 	user32.dll!xxxCheckDefPushButton()	Unknown
 	user32.dll!IsDialogMessageW()	Unknown
 	user32.dll!IsDialogMessageA()	Unknown
 	VO28Gui.dll!0388db39()	Unknown
 	VO28run.dll!1003ac0e()	Unknown
 	iConnect.exe!011e24a0()	Unknown
 	kernel32.dll!@BaseThreadInitThunk@12()	Unknown
 	ntdll.dll!__RtlUserThreadStart()	Unknown
 	ntdll.dll!__RtlUserThreadStart@8()	Unknown

It does offer the option to view the binary code but this code is not helpful in finding out what is happening, unfortunately.
A small piece of it looks like this:

74186B5C  int         3  
74186B5D  int         3  
74186B5E  int         3  
74186B5F  int         3  
_RealDefWindowProcA@16:
74186B60  mov         edi,edi  
74186B62  push        ebp  
74186B63  mov         ebp,esp  
74186B65  and         esp,0FFFFFFF8h  
74186B68  mov         ecx,dword ptr [ebp+8]  
74186B6B  call        ValidateHwnd (741679B0h)  
74186B70  mov         ecx,eax  
74186B72  or          ecx,edx  
74186B74  mov         ecx,dword ptr [ebp+0Ch]  
74186B77  je          __TlgWriteCommon@16+0C6h (7418F271h)  
74186B7D  push        1  
74186B7F  push        dword ptr [ebp+14h]  
74186B82  push        edx  
74186B83  mov         edx,dword ptr [ebp+10h]  
74186B86  push        eax  
74186B87  call        RealDefWindowProcWorker (74164C50h)  
74186B8C  mov         esp,ebp  
74186B8E  pop         ebp  
74186B8F  ret         10h  
74186B92  int         3  
74186B93  int         3  
74186B94  int         3  
74186B95  int         3  
74186B96  int         3  
_RtlWCSMessageWParamCharToMB@8:
74186B97  mov         edi,edi  
74186B99  push        ebp  
74186B9A  mov         ebp,esp  
74186B9C  push        ecx  
74186B9D  push        esi  
74186B9E  mov         esi,edx  
74186BA0  push        edi  
74186BA1  cmp         ecx,107h  
74186BA7  jbe         RtlWCSMessageWParamCharToMB+30h (74186BC7h)  
74186BA9  sub         ecx,10Fh  
74186BAF  je          RtlWCSMessageWParamCharToMB+52h (74186BE9h)  
74186BB1  sub         ecx,11h  
74186BB4  je          RtlWCSMessageWParamCharToMB+52h (74186BE9h)  
74186BB6  sub         ecx,166h  
74186BBC  je          RtlWCSMessageWParamCharToMB+52h (74186BE9h)  
74186BBE  xor         eax,eax  
74186BC0  pop         edi  

Kees.

On Wed, 10 Aug 2016 09:13:59 -0700 (PDT), Robert van der Hulst <rjvanderhulst@gmail.com> wrote:

>Kees,
>This what I would do:
>- Start Visual Studio
>- Start your app and navigate to the place where you can reproduce the error
>- Attach the Debugger in VS to your app (Debug, Attach, in Native mode)
>- Tell it to break on all Win32 and C++ Exceptions (Debug, Window, Exception settings)
>- Go to your app and press the tabkey.
>Then two things can happen:
>- your app generates an exception and VS breaks
>- your app freezes. In that case goto VS and choose Debug-Break All
>
>If you now look at the Debugger-CallStack window you will at least have an idea in which piece of your code the error appears.
You will not see source code, but you will be able to see the disassembled code, which may give you a clue about what is happening.
>
>
>Robert
>
>
>
>> Hi,
>> 
>> We use tab controls to display e-mails.
>> Each tab is a splitwindow; on one of the panes there is a pushbutton to display attachments.
>> When there is more than one tab opened, clicking on this pushbutton totally crashes the entire application.
>> The only way to end it is by using task manager.
>> It seems impossible to debug because clicking on the button immediately crashes the application
>> (turns white, no response) and the underlying code is never reached.
>> Does anyone know of a possible cause, or how to find a cause (debugging?) in this situation?
>> Thanks a lot in advance!
>> 
>> Kees Bouw.

[toc] | [prev] | [next] | [standalone]


#9613

FromRobert van der Hulst <rjvanderhulst@gmail.com>
Date2016-08-15 07:50 -0700
Message-ID<ebd46580-f577-4548-bba1-35d6e7fc9084@googlegroups.com>
In reply to#9612
Kees,
This is actually VERY helpfull (if you know what to look for).
As you can see in the callstack, the GUI Classes call IsDialogMessageA function in User32.
There is exactly ONE spot inside the VO Gui classes where this is called, and that is inside the Exec method of the App class.

If you look at the source from that message you will see that the code allows you to implement a App:BeforeDispatch() method. If that method returns FALSE then the code that calls IsDialogMessage will not be called.
So I would suggest:

- Create the BeforeDispatch method :
- Inside this method check for the uMsg == WM_KEYDOWN and wParam == VK_TAB
- When that happens, check to see if you are on the window that crashes, and when you are, process the key in another way and return FALSE. 

I am not sure which window you will see, most likely a dialogwindow that you have on the tabpage. If this is a generic dialog window class then you may have to check the owners to see where you are in the hierarchy.

One warning: this code gets called A LOT. So make sure it is optimized and for example does not check for the window and its hierarchy when you are not processing the specific key.

Something like this:

METHOD BeforeDispatch(hWnd , uMsg , wParam , lParam ) CLASS App
  LOCAL dwMessage as DWORD
  LOCAL dwParam   as DWORD
  LOCAL oWindow   as OBJECT
  LOCAL lIsCtrlKey  as LOGIC
  LOCAL lIsShiftKey as LOGIC
  dwMessage := uMsg
  dwParam   := wParam
  IF dwMessage == WM_KEYDOWN .and. dwParam == VK_TAB
     oWindow := __WCGetWindowByHandle(hWnd)
     IF IsInstanceOf(oWindow, #MySpecialWindow)
         lIsShiftKey := GetKeyState(VK_SHIFT) < 0
	 lIsCtrlKey  := GetKeyState(VK_CONTROL) < 0
         // Add own code to handle this key press
         // and return FALSE to disable the standard key handling
         RETURN FALSE
     ENDIF
  ENDIF
  RETURN TRUE

I hope this helps.

Robert


[toc] | [prev] | [next] | [standalone]


#9971

FromKees Bouw <kees@ic2.com>
Date2016-11-17 10:57 +0100
Message-ID<dlvq2cle7td24ge20r3jds32v96976g5ev@4ax.com>
In reply to#9613
Hi Robert and others who replied,

Thank you for your tips, especially the BeforeDispatch code.
I spent quite some time exploring this, and I did manage
to land the debugger into the BeforeDispatch method just
after the button was clicked and before the freeze happens.
I was hoping that stepping further would reveal where exactly
the freeze would occur, but that did not work. At the end of
the BeforeDispatch, I could step no further. Nothing happened
when using F8 or F10. I could have written alternative code
to deal with the pushbutton and then return false as you
suggested, but I found a better workaround. I experimented
with several other controls and found that only the pushbutton
resulted in a freeze. So I replaced the pushbutton with a
radiobutton and set the "Push Like" property to true, so it
looks just like a pushbutton. With the ButtonClick method
I execute the same code as before. In the end, it looks the
same, and it works fine!

Thanks again,

Kees Bouw.

On Mon, 15 Aug 2016 07:50:55 -0700 (PDT), Robert van der
 Hulst <rjvanderhulst@gmail.com> wrote:

>Kees,
>This is actually VERY helpfull (if you know what to look for).
>As you can see in the callstack, the GUI Classes cal
l IsDialogMessageA function in User32.
>There is exactly ONE spot inside the VO Gui classes where
 this is called, and that is inside the Exec method of the App class.
>
>If you look at the source from that message you will see
 that the code allows you to implement a App:BeforeDispatch()
 method. If that method returns FALSE then the code that
 calls IsDialogMessage will not be called.
>So I would suggest:
>
>- Create the BeforeDispatch method :
>- Inside this method check for the uMsg == WM_KEYDOWN
 and wParam == VK_TAB
>- When that happens, check to see if you are on the window
 that crashes, and when you are, process the key in another
 way and return FALSE. 
>
>I am not sure which window you will see, most likely a
 dialogwindow that you have on the tabpage. If this is a generic
 dialog window class then you may have to check the owners t
o see where you are in the hierarchy.
>
>One warning: this code gets called A LOT. So make sure it is
 optimized and for example does not check for the window
 and its hierarchy when you are not processing the specific key.
>
>Something like this:
>
>METHOD BeforeDispatch(hWnd , uMsg , wParam , lParam ) CLASS App
>  LOCAL dwMessage as DWORD
>  LOCAL dwParam   as DWORD
>  LOCAL oWindow   as OBJECT
>  LOCAL lIsCtrlKey  as LOGIC
>  LOCAL lIsShiftKey as LOGIC
>  dwMessage := uMsg
>  dwParam   := wParam
>  IF dwMessage == WM_KEYDOWN .and. dwParam == VK_TAB
>     oWindow := __WCGetWindowByHandle(hWnd)
>     IF IsInstanceOf(oWindow, #MySpecialWindow)
>         lIsShiftKey := GetKeyState(VK_SHIFT) < 0
>	 lIsCtrlKey  := GetKeyState(VK_CONTROL) < 0
>         // Add own code to handle this key press
>         // and return FALSE to disable the standard key handling
>         RETURN FALSE
>     ENDIF
>  ENDIF
>  RETURN TRUE
>
>I hope this helps.
>
>Robert
>
>

[toc] | [prev] | [next] | [standalone]


#9608

FromMartin <Martin@spam.spam>
Date2016-08-11 14:55 +0100
Message-ID<noi04b$sl5$1@dont-email.me>
In reply to#9597
When you first change GUI objects you leave the previous one, try 
clicking on lots of other things first to see what happens. Seems like 
something you are leaving is locking rather than what you are clicking on.

If you are really desperate look at all super:dispatch code for your 
classes and put into the screen dispatch with no super, and add a write 
to text file debug in it.



On 10/08/2016 16:23, Kees Bouw wrote:
> Hi,
>
> We use tab controls to display e-mails.
> Each tab is a splitwindow; on one of the panes there is a pushbutton to display attachments.
> When there is more than one tab opened, clicking on this pushbutton totally crashes the entire application.
> The only way to end it is by using task manager.
> It seems impossible to debug because clicking on the button immediately crashes the application
> (turns white, no response) and the underlying code is never reached.
> Does anyone know of a possible cause, or how to find a cause (debugging?) in this situation?
> Thanks a lot in advance!
>
> Kees Bouw.
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web