macos Sierra: Internal Error

Hi all,

macos Sierra beta v 7 (16A313a): when I activate the Menu that auto set the front window listbox columns to display all text (ooooo), I get a dialog who told me about Internal Error (Erreur interne). The details are below.

The excecuted code that generate the internal error is:

[code] Dim CenterWindow As Integer
CenterWindow = (Screen(0).AvailableWidth - Self.Width) \ 2

// Center the window in the front Screen
If ScreenCount = 0 Then
Self.Left = CenterWindow // If I replace CenterWindow with 10, no Internal Error…
Else
If Self.Width < Screen(0).AvailableWidth Then
Self.Left = 10 // CenterWindow
Else
Self.Left = Screen(0).AvailableWidth + ((Screen(1).AvailableWidth - Self.Width) \ 2)
End If
End If[/code]

Watch the comment above.

Is it possible that (Screen(0).AvailableWidth - Self.Width) \\ 2 returns a negative value ?
[in macos Sierra, I use the Retina screen size: 1280 x 800 while on El Capitan I use 3360 x 2100. No: I tried -10 instead of 10 and no error.]

Of course, this works fine with El Capitan.

[code]Nom de l’exception : NSRangeException
Description : *** -[__NSSingleObjectArrayI objectAtIndex:]: index 1 beyond bounds [0 … 0]
Informations sur l’utilisateur : (null)

0 CoreFoundation 0x9467621b __raiseError + 187
1 libobjc.A.dylib 0x9ed016e6 objc_exception_throw + 273
2 CoreFoundation 0x94661e88 -[__NSSingleObjectArrayI objectAtIndex:] + 152
3 XojoFramework 0x005952e4 Currency_FromText + 37451
4 Easy Displayer 0x00113104 REALbasic.Screen%o%i4 + 59
5 Easy Displayer 0x00194156 wMain.wMain.Columns_Auto_Widths%%o<wMain.wMain> + 7042
6 Easy Displayer 0x0017daf3 wMain.wMain._utilitiesAutoSettheColumnWidths_Action%b%o<wMain.wMain> + 67
7 XojoFramework 0x00657d0f RuntimeMenuItemLookupArray + 1617
8 XojoFramework 0x0059c66e RuntimeCompareAuto + 20082
9 XojoFramework 0x0059cb2a RuntimeCompareAuto + 21294
10 libobjc.A.dylib 0x9ecfbd1e -[NSObject performSelector:withObject:] + 59
11 AppKit 0x92c7890a __49-[NSApplication(NSResponder) sendAction:to:from:]_block_invoke + 35
12 libsystem_trace.dylib 0x9f77d67c _os_activity_initiate + 79
13 AppKit 0x92c7888a -[NSApplication(NSResponder) sendAction:to:from:] + 584
14 AppKit 0x927b231b -[NSMenuItem _corePerformAction] + 374
15 AppKit 0x927b2076 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 162
16 AppKit 0x927b17db -[NSMenu _performActionWithHighlightingForItemAtIndex:sendAccessibilityNotification:] + 74
17 AppKit 0x927b178c -[NSMenu _performActionWithHighlightingForItemAtIndex:] + 31
18 AppKit 0x927b1768 __31-[NSMenu performKeyEquivalent:]_block_invoke + 35
19 libsystem_trace.dylib 0x9f77d67c _os_activity_initiate + 79
20 AppKit 0x927b1077 -[NSMenu performKeyEquivalent:] + 357
21 AppKit 0x92c7744e routeKeyEquivalent + 854
22 AppKit 0x92c770f0 -[NSApplication(NSEvent) _handleKeyEquivalent:] + 17
23 AppKit 0x92c75997 -[NSApplication(NSEvent) sendEvent:] + 3551
24 XojoFramework 0x005b05c9 ParseJSON + 12347
25 AppKit 0x9256d1c5 -[NSApplication run] + 1018
26 XojoFramework 0x006d72b7 SSLSettings_SetValidateCertificates + 1127
27 XojoFramework 0x006d584c RuntimeRun + 49
28 Easy Displayer 0x001145d3 REALbasic._RuntimeRun + 34
29 Easy Displayer 0x00005028 _Main + 257
30 Easy Displayer 0x00002650 main + 36
[/code]

I tend to use the other division (/) operator:

I’m running Sierra and use similar code but haven’t seen the same crash.

[quote=285129:@Emile Schwarz] Self.Left = Screen(0).AvailableWidth + ((Screen(1).AvailableWidth - Self.Width) \\ 2) [/quote]

This uses an index of 1 for the second portion of the expression, but you’ve only verified that there is one screen. This shouldn’t crash though, so a bug report would be in order.

at http://developer.xojo.com, a search for \ or / leads to nothing (many things, but not what was asked).

/: Used to perform floating-point division between two numbers.

So \ is the correct way to divide number of pixels, IMHO.

PS: http://documentation.xojo.com search returns something (there si a page named "/"…).

Hi Greg !

I had to read thrice your simple line before I realized (and saw) the 1 in Screen(1)… There is many months I do not connect my external monitor into my MacBook Pro (I use it as a TV monitor, connected to my PC laptop…). So that part of the code would not be tested (here).

I will create the bug report (after my lunch), but the line where Screen(1) is, is skipped (not run) when I tested earlier. I put a break point when I located the code that was wrong.

BTW: good catch !

And of course, I am not running tacos Sierra right now, and I am running in another user sessions (and I cannot write in the project !). When something is starting wrong…

The code as is works fine on El Capitan, on another user session. On the other hand, I had a crash in the debugger when I wanted to write some preferences: I have a bug there, obviously :wink:

Greg?

Strange. I meant Joe.

Thank you Thomas for noticing that.