Opened 19 years ago

Closed 18 years ago

Last modified 18 years ago

#406 closed bug (fixed)

[DiskProbe] menus don't work

Reported by: diver Owned by: jackburton
Priority: normal Milestone: R1
Component: - General Version:
Keywords: Cc: ajsmale@…
Blocked By: Blocking:
Platform: All

Description

menus don't work in rev17009 undev vmware.

Attachments (1)

patch.diff (486 bytes ) - added by jackburton 18 years ago.
Replaced Unlock() with UnlockFully() in BWindow destructor

Download all attachments as: .zip

Change History (48)

comment:1 by jackburton, 19 years ago

Owner: changed from axeld to jackburton

comment:2 by jackburton, 19 years ago

Cc: ajsmale@… added

comment:3 by jackburton, 19 years ago

* Bug 413 has been marked as a duplicate of this bug. *

comment:4 by diver, 19 years ago

Also if you click on menu and then quit diskprobe it will stay in Deskbar. This is the same with Mouse app and maybe some other as well.

comment:5 by jackburton, 19 years ago

I noticed. I probably know already what's wrong.

comment:6 by jackburton, 19 years ago

Status: newassigned

comment:7 by jackburton, 19 years ago

Looks like a deadlock in BMenuBar::Track()

comment:8 by jackburton, 19 years ago

I debugged it a bit and these are the results: The menubar tries to acquire the window lock, but it's currently acquired by the window thread, which is blocking on a port semaphore (owner is -1, means owned by a port, right?). Any idea, Axel ?

comment:9 by jackburton, 19 years ago

Cc: axeld@… added

comment:10 by jackburton, 19 years ago

Resolution: fixed

comment:11 by jackburton, 19 years ago

Status: assignedclosed

comment:12 by jackburton, 19 years ago

Fixed in hrev17154, BSlider locked the looper on Draw() and never unlocked it.

comment:13 by diver, 19 years ago

Resolution: fixed

comment:14 by diver, 19 years ago

Comment #2 isn't fixed, reopening.

comment:15 by diver, 19 years ago

Status: closedreopened

comment:16 by jackburton, 18 years ago

I cant' reproduce the problem described in comment 2, does is still apply ?

comment:17 by diver, 18 years ago

(In reply to comment #8)

I cant' reproduce the problem described in comment 2, does is still apply ?

Yes, it is. I just tested with hrev18026 under vmware. What i dis is:

  1. Launched DiskProbe and clicked File menu
  2. While File menu is opened pressed Alt+q

comment:18 by jackburton, 18 years ago

Fixed in hrev18156

comment:19 by jackburton, 18 years ago

Status: reopenedclosed

comment:20 by jackburton, 18 years ago

Resolution: fixed

comment:21 by diver, 18 years ago

Status: closedreopened

comment:22 by diver, 18 years ago

I'm sorry, but i've just checked it several times with hrev18260 under vmware and this bug is still there. Reopening...

comment:23 by diver, 18 years ago

Resolution: fixed

comment:24 by diver, 18 years ago

Hmm, i'm not sure, but this could be due something with svn access on the phillip's server http://www.schmidp.com/index.php?option=com_files&path=/haiku/ images/ As you could see rev*_svn.log files are empty at the moment. So this bug could be already fixed indeed. Need to check it out.

comment:25 by jackburton, 18 years ago

Can I close this bug ? I definitely can't reproduce it anymore, nor under vmware, nor qemu, nor on real hardware.

comment:26 by jackburton, 18 years ago

Status: reopenedclosed

comment:27 by jackburton, 18 years ago

Resolution: fixed

comment:28 by diver, 18 years ago

Comment #2 still isn't fixed, reopening, hrev18356.

comment:29 by jackburton, 18 years ago

Which revision are you trying ? I definitely can't reproduce this bug anymore. If you still can, may you write down the exact steps you use to reproduce it ?

comment:30 by diver, 18 years ago

(In reply to comment #15)

Which revision are you trying ? I definitely can't reproduce this bug anymore. If you still can, may you write down the exact steps you use to reproduce it ?

I'm trying hrev18453. This is how i reproduce it: After Haiku starts i'm typing in Terminal DiskProbe, then press Probe Device. Now that DiskProbe window is opened i'm clicking "File" menu and while it open pressing alt+w. DiskProbe's window will close but will stay in Deskbar until i kill it. Hope this would help.

comment:31 by axeld, 18 years ago

Status: closedreopened

comment:32 by axeld, 18 years ago

Yes, it did, at least I can reproduce it with these steps under Qemu.

comment:33 by axeld, 18 years ago

Resolution: fixed

comment:34 by jackburton, 18 years ago

Yes, now I can reproduce it too. Following the other method

  1. Launched DiskProbe and clicked File menu
  2. While File menu is opened pressed Alt+q

I can't reproduce it anymore, though.

comment:35 by jackburton, 18 years ago

Status: reopenedassigned

comment:36 by diver, 18 years ago

Another variation: Launch any app wich have menu bar (StyledEdit, DiskProbe), click in the empty region of menu bar and then try to close this app, it will stay in the deskbar.

comment:37 by jackburton, 18 years ago

(In reply to comment #19)

Another variation: Launch any app wich have menu bar (StyledEdit, DiskProbe), click in the empty region of menu bar and then try to close this app, it will stay in the deskbar.

That shouldn't happen anymore. I also tracked down the bug, it's a deadlock. I can fix it by using LockWithTimeout() inside BMenuBar::Track() instead of Lock(). I'm almost sure beos did the same, but it works very bad in Qemu on slow systems. I'll try to find another solution.

comment:38 by jackburton, 18 years ago

I have some doubts. Axel (or anyone who knows) can you clarify ? In the following code:

BWindow::~BWindow() {

if (BMenu *menu = dynamic_cast<BMenu *>(fFocus)) {

menu->QuitTracking();

}

The BWindow is locked when the destructor is called, we need to unlock because the menubar thread tries to post a message, which will deadlock otherwise. Unlock();

Is it normal that after that Unlock() call, the window is still locked when ALT-W is used to close it, and it's unlocked when ALT-Q is used ? That's what is causing the deadlock.

comment:39 by jackburton, 18 years ago

I tried changing that Unlock() call to UnlockFully() and it doesn't deadlock anymore. Since it's done in the destructor shouldn't hurt, but I'd like if someone reviewed the change, though.

by jackburton, 18 years ago

Attachment: patch.diff added

Replaced Unlock() with UnlockFully() in BWindow destructor

comment:40 by axeld, 18 years ago

Don't be so shy, I would have shot you anyway if you commited something wrong to the repository ;-) I think the change is fine.

When using Alt-W the window is quit from its own quit loop, while when you press Alt-Q, the application itself is quitting it. In both cases, the window should only be locked once, though, at least AFAICT. Maybe there is an extra Lock() somewhere causing it, but I dunno. Any idea?

comment:41 by jackburton, 18 years ago

(In reply to comment #24)

Don't be so shy, I would have shot you anyway if you commited something wrong to the repository ;-)

Eheh, okay :)

I think the change is fine.

Ok, I'm applying it.

When using Alt-W the window is quit from its own quit loop, while when you press Alt-Q, the application itself is quitting it.

Ok, makes sense. I was thinking something like that. Thank you.

In both cases, the window should only be locked once, though, at least AFAICT. Maybe there is an extra Lock() somewhere causing it, but I dunno. Any idea?

I searched that extra Lock() for a while, but without luck. The problem is that the flow isn't easy to follow, because some parts are in BLooper and some in BWindow. I hoped someone else knew that part better :)

comment:42 by jackburton, 18 years ago

Resolution: fixed

comment:43 by jackburton, 18 years ago

Fixed in hrev18579

comment:44 by jackburton, 18 years ago

Status: assignedclosed

comment:45 by axeld, 18 years ago

Maybe it's just because Alt-Q closes all windows, and with Alt-W, the menu window keeps a lock around?

comment:46 by jackburton, 18 years ago

(In reply to comment #27)

Maybe it's just because Alt-Q closes all windows, and with Alt-W, the menu window keeps a lock around?

Could be. Either the Menubar or the menu itself, although the deadlock happened inside BMenuBar::Track(), when menubar tried to acquire the window lock. I'll try to debug it, though, and see if it's the case.

comment:47 by jackburton, 18 years ago

(In reply to comment #28)

(In reply to comment #27)

Maybe it's just because Alt-Q closes all windows, and with Alt-W, the menu window keeps a lock around?

Could be. Either the Menubar or the menu itself, although the deadlock happened inside BMenuBar::Track(), when menubar tried to acquire the window lock. I'll try to debug it, though, and see if it's the case.

I added some more debug output, and seems the window is locked twice indeed by its own thread. We just need to find out where this happen. For the moment we can live with this solution, though, as it seems safe.

Note: See TracTickets for help on using tickets.