[haiku-bugs] Re: [Haiku] #12286: Menus seem to be leaking ports

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Thu, 06 Aug 2015 12:02:28 -0000

#12286: Menus seem to be leaking ports
----------------------------------+----------------------------
Reporter: ttcoder | Owner: axeld
Type: bug | Status: new
Priority: high | Milestone: R1/beta1
Component: Kits/Interface Kit | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
----------------------------------+----------------------------

Comment (by bonefish):

Replying to [comment:11 ttcoder]:

''EDIT2:'' Errr ok, in fact it seems Track() does terminate, and does
not crash in ASSERT() simply because libbe.so is built in release mode
(?), and (get this), the dtor ''is'' called but interrupts itself before
actually freeing the resources, because kill_thread() actually kills
itself. Am I making sense at all? Dunno.

So we do leak the MouseDownThread object whenever the menu is opened and
closed, right ?

Yes. Moreover the `kill_thread()` is causing the first leak you noticed.
`kill_thread()` explicitly skips clean-ups associated with the termination
of the thread (unlike `exit_thread()`), among those the deallocation of
the pthread object. So `MouseDownThread` is not a well-behaved citizen at
all.

Once the above is dealt with I'll return to the supposed BMenu leak..
Or maybe before embarking on that, it would be interesting compile
libbe.so with [http://cgit.haiku-
os.org/haiku/tree/src/kits/interface/Menu.cpp#n50 this define] commented
out and see if the port leak disappears?

Doesn't hurt to try, I guess.

--
Ticket URL: <https://dev.haiku-os.org/ticket/12286#comment:12>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: