Issue 74392 - aquavcl01: tooltip crash
Summary: aquavcl01: tooltip crash
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: MacOSX (show other issues)
Version: 680m202
Hardware: All Mac OS X, all
: P3 Trivial (vote)
Target Milestone: OOo 2.3
Assignee: msicotte
QA Contact: issues@porting
URL:
Keywords: aqua
Depends on:
Blocks: 74396
  Show dependency tree
 
Reported: 2007-02-09 23:35 UTC by pavel
Modified: 2007-07-09 22:35 UTC (History)
4 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
tooltips displayed slowly from above (202.47 KB, image/png)
2007-02-11 08:19 UTC, sparcmoz
no flags Details
note frame 400 (72.90 KB, text/plain)
2007-02-11 08:51 UTC, sparcmoz
no flags Details
reproduce - with extended tooltips (85.77 KB, text/plain)
2007-02-11 09:44 UTC, sparcmoz
no flags Details
test patch to stop crash (184.21 KB, image/png)
2007-02-15 10:54 UTC, sparcmoz
no flags Details
patch to salframe.cxx to fix tooltip crashes (2.15 KB, text/plain)
2007-03-29 22:50 UTC, msicotte
no flags Details
patch for testing events to remove for tooltips (3.94 KB, text/plain)
2007-04-06 20:29 UTC, msicotte
no flags Details
patch for testing - adds fix for menu to tooltip crash fix (4.76 KB, text/plain)
2007-04-09 22:25 UTC, msicotte
no flags Details
Fixed bug in earlier patch disabling closebox (4.84 KB, text/plain)
2007-04-10 02:23 UTC, msicotte
no flags Details
Workaround for event that causes crash, with fix for disappearing menu (2.34 KB, text/plain)
2007-05-11 03:37 UTC, msicotte
no flags Details
Workaround event that causes tooltip crash (1.72 KB, text/plain)
2007-05-11 22:10 UTC, msicotte
no flags Details
Workaround event that causes tooltip crash (an extra hunk in the last one) (1.49 KB, text/plain)
2007-05-11 22:20 UTC, msicotte
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description pavel 2007-02-09 23:35:00 UTC
Hi,

with clean m202 based aquavcl01, clean, just installed OOo and after the successful FirstStartWizard 
session:

1. start sofficebin
    -> initial window with three icons in the toolbar appear.
2. quickly move over them to see their tooltips.
    -> after a second or two, crash:

>*>_> ReleaseGraphics
>*>_> ~AquaSalFrame
>*>_> SetPointer

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000009
0x00000009 in ?? ()
(gdb) where
#0  0x00000009 in ?? ()
#1  0x0135c537 in SalFrame::CallCallback (this=0x54898455, nEvent=49284, pEvent=0x12f3e824) at 
salframe.hxx:315
Previous frame inner to this frame (corrupt stack?)
(gdb) 

Please write here if you can reproduce it.
Comment 1 shaunmcdonald131 2007-02-10 10:37:06 UTC
Adding to Meta Issue.
Comment 2 sparcmoz 2007-02-11 01:20:03 UTC
It is possible to reliably un-reproduce these crashes. You will need a
combination of speed and careful mouse movement to avoid triggering any tooltips
while doing this: Go to menu Tools - Options - OOo - General - Help - uncheck
Tips. Now the tooltips crashing is no longer seen.
Comment 3 sparcmoz 2007-02-11 08:18:31 UTC
Carefully moving the mouse in from above the window, each of the tooltips can be
displayed without a crash. See attached picture. 
Comment 4 sparcmoz 2007-02-11 08:19:53 UTC
Created attachment 42920 [details]
tooltips displayed slowly from above
Comment 5 sparcmoz 2007-02-11 08:34:05 UTC
Quickly move mouse over the toolbar icons, for me it always ends here:

Thread 0 Crashed:
0   libvcl680mxi.dylib             	0x011c150f Window::GetStyle() const + 15
(window2.cxx:1703)
1   libvcl680mxi.dylib             	0x011b930e ImplHandleResize(Window*, long,
long) + 28
2   libvcl680mxi.dylib             	0x011ac39a Window::SetPosSizePixel(long,
long, long, long, unsigned short) + 456
3   libvcl680mxi.dylib             	0x011c1d88 Window::SetPosPixel(Point const&)
+ 82 (window2.cxx:2044)
4   libvcl680mxi.dylib             	0x0100ad99 ImplSetHelpWindowPos(Window*,
unsigned short, unsigned short, Point const&, Rectangle const*) + 1205
 
Comment 6 sparcmoz 2007-02-11 08:51:55 UTC
Created attachment 42921 [details]
note frame 400
Comment 7 sparcmoz 2007-02-11 09:29:23 UTC
The long stacktrace with many times CallCallBack is made by slowly mouse over
the top row of toolbar icons and showing the tooltips, repeat this many times. I
just made another with 405 lines. I can reliably reproduce in range 50-130
backtrace with mulitple CallCallBack. Note that some icons are not drawn (not
visible) until the mouse over. The mouse button is not pressed at any time.
Comment 8 sparcmoz 2007-02-11 09:44:42 UTC
Created attachment 42923 [details]
reproduce - with extended tooltips
Comment 9 sparcmoz 2007-02-13 11:49:33 UTC
Test suggested by pjanik: disable MouseMove events. 
Now the tips work in the correct manner ( delay, then display, then removed )
when the mouse is moved over a toolbat icon and the mouse button held down for a
while.

How to disable:
+++ aqua/source/window/salframe.cxx     13 Feb 2007 11:48:57 -0000
@@ -1202,7 +1202,7 @@
     case kEventMouseUp:
         eventkind = SALEVENT_MOUSEBUTTONUP;
         break;
-    case kEventMouseMoved:
+//    case kEventMouseMoved:
     case kEventMouseDragged:
         eventkind = SALEVENT_MOUSEMOVE;
         break;
Comment 10 sparcmoz 2007-02-14 09:20:37 UTC
Another test: disable mouse button down (see how below). The mouse down action
is stopped (for example the font name list cannot be activated). But the bad
behaviour of tooltips continues, and crash still happens.
+++ aqua/source/window/salframe.cxx     14 Feb 2007 09:15:20 -0000
@@ -1196,9 +1196,9 @@
 
     switch (GetEventKind(inEvent))
     {
-    case kEventMouseDown:
-        eventkind = SALEVENT_MOUSEBUTTONDOWN;
-        break;
+//    case kEventMouseDown:
+//        eventkind = SALEVENT_MOUSEBUTTONDOWN;
+//        break;
Comment 11 sparcmoz 2007-02-14 21:34:25 UTC
The proper behaviour of tool tips for an object would require events such as
object.mouse_enter and object.mouse_leave. The tooltip starts when the mouse
enters, and stops or will not start again until after object.mouse_leave. How
does this work for X11? There is a test for these events in
vcl/source/window/winproc.cxx line 680 and sets a flag MOUSE_ENTERWINDOW at line
721.
 
Comment 12 sparcmoz 2007-02-15 09:20:29 UTC
This patch stops the tooltip crashes, but the result is not quite correct ;)

Index: aqua/source/window/salframe.cxx
===================================================================
RCS file: /cvs/gsl/vcl/aqua/source/window/salframe.cxx,v
retrieving revision 1.46.112.48
diff -u -r1.46.112.48 salframe.cxx
--- aqua/source/window/salframe.cxx     13 Feb 2007 09:16:30 -0000      1.46.112.48
+++ aqua/source/window/salframe.cxx     15 Feb 2007 09:17:51 -0000
@@ -627,7 +627,7 @@
             currentWindowRect.left, currentWindowRect.top,
currentWindowRect.right - currentWindowRect.left, currentWindowRect.bottom -
currentWindowRect.top);
     fprintf(stderr, "SetPosSize: New rect (x: %d, y: %d, w: %d, h: %d)\n", nX,
nY, nWidth, nHeight);
      */
-    SetWindowBounds(mrWindow, kWindowStructureRgn, &newWindowRect);
+//    SetWindowBounds(mrWindow, kWindowStructureRgn, &newWindowRect);
     
     UpdateFrameGeometry();
 
Comment 13 sparcmoz 2007-02-15 10:53:48 UTC
Next attachment is a screenshot of the behaviour with the last patch. There is
no crash but every child window instead becomes a separate parent window/frame.
(Not sure if that is the right description!). I cannot capture the tooltip
example as it is timed - but imagine a little tooltip in the top left hand corner. 
Comment 14 sparcmoz 2007-02-15 10:54:53 UTC
Created attachment 43030 [details]
test patch to stop crash
Comment 15 msicotte 2007-03-21 04:53:56 UTC
While looking into this issue I noticed the following behavior, which may be
getting s closer to the real problem:

1)  Put breakpoints as shown:

    Breakpoint 8, Window::IsNativeControlSupported (this=0x6d87b00, nType=100,
nPart=1) at window3.cxx:95
(gdb)

    Breakpoint 7, AquaSalGraphics::IsNativeControlSupported (this=0x6d83720,
nType=140, nPart=1) at salnativewidgets.cxx:186
(gdb) 

2)  Move the mouse over the toolbars to activevate the tooltips.

3)  Step from Window::IsNativeControlSupported into
AquaSalGraphics::IsNativeControlSupported

4)  Notice that nType changes from 100 to 140?

I thought this meant that there is a conflicting definition for ControlType, but
so far I have not been able to find it.

Other ideas?
Comment 16 msicotte 2007-03-21 18:43:24 UTC
Here is a disassembly of the exact place where the value of nType changes - at
the return from the thunk in AquaSalGraphics::IsNativeControlSupported:
1: nType = 100
0x01250afa <_ZN15AquaSalGraphics24IsNativeControlSupportedEmm+8>:	call  
0x127076c <__i686.get_pc_thunk.bx>
1: nType = 100
0x0127076c in __i686.get_pc_thunk.bx () at gcach_ftyp.cxx:325
0x0127076c <__i686.get_pc_thunk.bx+0>:	mov    (%esp),%ebx
0x0127076f <__i686.get_pc_thunk.bx+3>:	ret    
0x01250aff <_ZN15AquaSalGraphics24IsNativeControlSupportedEmm+13>:	movb  
$0x0,-9(%ebp)
1: nType = 140

It seems like a problem with the inheritance, but beyond my capability at the
moment.  Does it happen for anyone else?

Comment 17 msicotte 2007-03-29 22:50:30 UTC
Created attachment 44027 [details]
patch to salframe.cxx to fix tooltip crashes
Comment 18 msicotte 2007-03-29 22:53:40 UTC
Patch salframe_tooltip.cxx.diff works by limiting the events that windows of
type kHelpWindowClass (tooltips) respond to.  It seems that
CreateNewSystemWindow was registering handlers for tooltip windows that could
not be handled.  Works on MacBook - others please try.
Comment 19 eric.bachard 2007-03-29 23:10:18 UTC
I confirm : the patch works fine : no more crash, tooltips appear, disappear
when moving the mouse.
This issue is IMHO fixed. 

+1 for it's integration 

ericb->msicotte

Thank you very much for your patch, and your great work !
( I imagine, it took you some time to analyse the situation with all those events)
Comment 20 sparcmoz 2007-03-29 23:12:04 UTC
Patch tested on iMac Intel with m202 and no other patches. The crash is gone and
tooltips behave as expected on the toolbars. I notice in dialogs the tooltips
only work *sometimes* but that will be a different issue.
Comment 21 pavel 2007-03-31 13:06:44 UTC
msicotte: can you please identify which eventhandler exactly is causeing the crash? This way we could 
identify the real problem.
Comment 22 msicotte 2007-03-31 13:33:53 UTC
To get you started, HandleOOoSalUserEvent causes the crash with the corrupt
stack frame.  

But other events cause different crashes.  

I will investigate all and come back with a comprehensive list.
Comment 23 msicotte 2007-04-06 20:28:49 UTC
I have to retract my previous comment - this week I have only removed 

HandleWindowBoundsChangedEvent 

for tooltips and I have had no crashes.

I am attaching a patch that does only this, but includes all of the other events
in a manner that allows for easy commenting if others would like to try.  If
this is the only troublemaker, then I can propose a much simpler patch.
Comment 24 msicotte 2007-04-06 20:29:54 UTC
Created attachment 44262 [details]
patch for testing events to remove for tooltips
Comment 25 msicotte 2007-04-09 22:25:12 UTC
Created attachment 44295 [details]
patch for testing - adds fix for menu to tooltip crash fix
Comment 26 msicotte 2007-04-09 22:25:49 UTC
I noticed that when the tooltip window was displayed, the menu bar was blanked.
 So I have amended the patch to add some code to keep the menu in view.  Patch
attached.
Comment 27 msicotte 2007-04-10 02:23:08 UTC
Created attachment 44298 [details]
Fixed bug in earlier patch disabling closebox
Comment 28 msicotte 2007-04-10 02:24:23 UTC
The earlier patch had an error that caused the close box to be disabled on the
windows.  Corrected patch attached.
Comment 29 eric.bachard 2007-04-10 07:48:06 UTC
ericb->msicotte

Thanks for all the work you do. 

@all : please test and report what you think important. It would be great to fix, or at least find a clean 
workaround to this bug.
Comment 30 msicotte 2007-05-11 03:37:23 UTC
Created attachment 45038 [details]
Workaround for event that causes crash, with fix for disappearing menu
Comment 31 msicotte 2007-05-11 22:10:31 UTC
Created attachment 45061 [details]
Workaround event that causes tooltip crash
Comment 32 msicotte 2007-05-11 22:20:21 UTC
Created attachment 45062 [details]
Workaround event that causes tooltip crash (an extra hunk in the last one)
Comment 33 pavel 2007-05-12 09:52:20 UTC
msicotte: please commit your last patch.

Works OK.
Comment 34 msicotte 2007-05-12 20:35:31 UTC
final patch committed
Comment 35 eric.bachard 2007-05-13 23:06:58 UTC
Added issue to aquavcl01 cws
Comment 36 jjmckenzie 2007-05-21 01:36:56 UTC
Verify that issue is indeed fixed in aquavcl01 cws through build provided by
Eric Bachard.
James McKenzie
Comment 37 pavel 2007-06-28 07:02:58 UTC
Change target milestone to 2.3.
Comment 38 eric.bachard 2007-07-09 22:35:18 UTC
Still ok in SRC680_m220

Closing