Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
3ad48cb8
Commit
3ad48cb8
authored
5 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Fix leak of context menu branch menus
parent
34da181e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llui/llmenugl.cpp
+40
-18
40 additions, 18 deletions
indra/llui/llmenugl.cpp
indra/llui/llmenugl.h
+3
-4
3 additions, 4 deletions
indra/llui/llmenugl.h
with
43 additions
and
22 deletions
indra/llui/llmenugl.cpp
+
40
−
18
View file @
3ad48cb8
...
@@ -3990,25 +3990,39 @@ void LLTearOffMenu::closeTearOff()
...
@@ -3990,25 +3990,39 @@ void LLTearOffMenu::closeTearOff()
}
}
LLContextMenuBranch
::
LLContextMenuBranch
(
const
LLContextMenuBranch
::
Params
&
p
)
LLContextMenuBranch
::
LLContextMenuBranch
(
const
LLContextMenuBranch
::
Params
&
p
)
:
LLMenuItemGL
(
p
),
:
LLMenuItemGL
(
p
)
mBranch
(
p
.
branch
()
->
getHandle
()
)
{
LLContextMenu
*
branch
=
static_cast
<
LLContextMenu
*>
(
p
.
branch
);
if
(
branch
)
{
{
mBranch
.
get
()
->
hide
();
mBranchHandle
=
branch
->
getHandle
();
mBranch
.
get
()
->
setParentMenuItem
(
this
);
branch
->
hide
();
branch
->
setParentMenuItem
(
this
);
}
}
LLContextMenuBranch
::~
LLContextMenuBranch
()
{
if
(
mBranchHandle
.
get
())
{
mBranchHandle
.
get
()
->
die
();
}
}
}
// called to rebuild the draw label
// called to rebuild the draw label
void
LLContextMenuBranch
::
buildDrawLabel
(
void
)
void
LLContextMenuBranch
::
buildDrawLabel
(
void
)
{
{
auto
menu
=
getBranch
();
if
(
menu
)
{
{
// default enablement is this -- if any of the subitems are
// default enablement is this -- if any of the subitems are
// enabled, this item is enabled. JC
// enabled, this item is enabled. JC
U32
sub_count
=
m
Branch
.
get
()
->
getItemCount
();
U32
sub_count
=
m
enu
->
getItemCount
();
U32
i
;
U32
i
;
BOOL
any_enabled
=
FALSE
;
BOOL
any_enabled
=
FALSE
;
for
(
i
=
0
;
i
<
sub_count
;
i
++
)
for
(
i
=
0
;
i
<
sub_count
;
i
++
)
{
{
LLMenuItemGL
*
item
=
m
Branch
.
get
()
->
getItem
(
i
);
LLMenuItemGL
*
item
=
m
enu
->
getItem
(
i
);
item
->
buildDrawLabel
();
item
->
buildDrawLabel
();
if
(
item
->
getEnabled
()
&&
!
item
->
getDrawTextDisabled
()
)
if
(
item
->
getEnabled
()
&&
!
item
->
getDrawTextDisabled
()
)
{
{
...
@@ -4030,13 +4044,17 @@ void LLContextMenuBranch::buildDrawLabel( void )
...
@@ -4030,13 +4044,17 @@ void LLContextMenuBranch::buildDrawLabel( void )
void
LLContextMenuBranch
::
showSubMenu
()
void
LLContextMenuBranch
::
showSubMenu
()
{
{
LLMenuItemGL
*
menu_item
=
mBranch
.
get
()
->
getParentMenuItem
();
auto
menu
=
getBranch
();
if
(
menu
)
{
LLMenuItemGL
*
menu_item
=
menu
->
getParentMenuItem
();
if
(
menu_item
!=
NULL
&&
menu_item
->
getVisible
())
if
(
menu_item
!=
NULL
&&
menu_item
->
getVisible
())
{
{
S32
center_x
;
S32
center_x
;
S32
center_y
;
S32
center_y
;
localPointToScreen
(
getRect
().
getWidth
(),
getRect
().
getHeight
(),
&
center_x
,
&
center_y
);
localPointToScreen
(
getRect
().
getWidth
(),
getRect
().
getHeight
(),
&
center_x
,
&
center_y
);
mBranch
.
get
()
->
show
(
center_x
,
center_y
);
menu
->
show
(
center_x
,
center_y
);
}
}
}
}
}
...
@@ -4050,13 +4068,17 @@ void LLContextMenuBranch::setHighlight( BOOL highlight )
...
@@ -4050,13 +4068,17 @@ void LLContextMenuBranch::setHighlight( BOOL highlight )
{
{
if
(
highlight
==
getHighlight
())
return
;
if
(
highlight
==
getHighlight
())
return
;
LLMenuItemGL
::
setHighlight
(
highlight
);
LLMenuItemGL
::
setHighlight
(
highlight
);
auto
menu
=
getBranch
();
if
(
menu
)
{
if
(
highlight
)
if
(
highlight
)
{
{
showSubMenu
();
showSubMenu
();
}
}
else
else
{
{
mBranch
.
get
()
->
hide
();
menu
->
hide
();
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
indra/llui/llmenugl.h
+
3
−
4
View file @
3ad48cb8
...
@@ -735,8 +735,7 @@ class LLContextMenuBranch : public LLMenuItemGL
...
@@ -735,8 +735,7 @@ class LLContextMenuBranch : public LLMenuItemGL
LLContextMenuBranch
(
const
Params
&
);
LLContextMenuBranch
(
const
Params
&
);
virtual
~
LLContextMenuBranch
()
virtual
~
LLContextMenuBranch
();
{}
// called to rebuild the draw label
// called to rebuild the draw label
virtual
void
buildDrawLabel
(
void
);
virtual
void
buildDrawLabel
(
void
);
...
@@ -744,13 +743,13 @@ class LLContextMenuBranch : public LLMenuItemGL
...
@@ -744,13 +743,13 @@ class LLContextMenuBranch : public LLMenuItemGL
// onCommit() - do the primary funcationality of the menu item.
// onCommit() - do the primary funcationality of the menu item.
virtual
void
onCommit
(
void
);
virtual
void
onCommit
(
void
);
LLContextMenu
*
getBranch
()
{
return
mBranch
.
get
();
}
LLContextMenu
*
getBranch
()
{
return
mBranch
Handle
.
get
();
}
void
setHighlight
(
BOOL
highlight
);
void
setHighlight
(
BOOL
highlight
);
protected
:
protected
:
void
showSubMenu
();
void
showSubMenu
();
LLHandle
<
LLContextMenu
>
mBranch
;
LLHandle
<
LLContextMenu
>
mBranch
Handle
;
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment