Greetings,
I experienced some weird crashes in my app and decided to track them down.
Basically, any related UI action would crash the app (with no log from
CrashReporter), including clicking the menu bar and showing windows. It turns
out my problem is related to a NSMenuMBS object, and is reproducible in a small
project (on my 10.4 PPC Mac at least).
Here's my code:
The properties of the window:
NSMenu as NSMenuMBS
NSMLaunchApp As NSMenuItemMBS
NSMSendDirectMessage As NSMenuItemMBS
StatusMenu As NSStatusItemMBS
The code (e.g. in Open):
dim b As Boolean
dim f As FolderItem
dim g As Graphics
dim i As NSImageMBS
dim q As Picture
NSMenu=new NSMenuMBS("Test")
NSMLaunchApp=new NSMenuItemMBS
NSMLaunchApp.CreateMenuItem("Lancer")
NSMSendDirectMessage=new NSMenuItemMBS
NSMSendDirectMessage.CreateMenuItem("Envoyer")
NSMenu.addItem(NSMLaunchApp)
NSMenu.addItem(NSMSendDirectMessage)
StatusMenu=new NSStatusItemMBS
b=StatusMenu.CreateMenuMiddle(35)
if not b then Break
StatusMenu.Enabled=True
StatusMenu.HighlightMode=True
StatusMenu.Menu=NSMenu
StatusMenu.SendActionOn(2)
StatusMenu.Title=""
dim j As Integer
j=min(StatusMenu.Width,StatusMenu.Height)
q=New Picture(j,j,32)
g=q.Graphics
g.FillOval 0,0,g.Width-1,g.Height-1
q.Mask.Graphics.FillOval 0,0,g.Width-1,g.Height-1
i=new NSImageMBS(q)
StatusMenu.image=i
In MouseDown:
dim w As new Window1
The results I get:
•The main menu bar has these menus: Test File Edit
(the “Test” reflects the NSMenu=new NSMenuMBS("Test") line)
•The status menu bar (right) is correct (an icon with a working menu)
•If I click the menu bar (left part), the app crashes. Also, with the code
above showing a window in the MouseDown event, clicking on the window briefly
shows another window and then the app crashes. Minimizing the existing window
produces the same crash.
•If I comment out the line «StatusMenu.Menu=NSMenu», I don't get this extra
“Test” menu in the menu bar (of course, my status item has no menu either). I
don't get crashes in this case.
So it seems this additional “Test” NSMenu in the left menu bar is perturbing
the UI, but I don't know why it appears there. Would it be possible for you to
reproduce or correct this bug? Unless I've done something wrong…
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info