Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
31ae6a90
Commit
31ae6a90
authored
Oct 24, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/toolbar: Don't leak button strings.
parent
b8d7088e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
toolbar.c
dlls/comctl32/toolbar.c
+20
-8
No files found.
dlls/comctl32/toolbar.c
View file @
31ae6a90
...
...
@@ -315,6 +315,11 @@ TOOLBAR_DumpToolbar(const TOOLBAR_INFO *iP, INT line)
}
}
static
inline
BOOL
TOOLBAR_ButtonHasString
(
const
TBUTTON_INFO
*
btnPtr
)
{
return
HIWORD
(
btnPtr
->
iString
)
&&
btnPtr
->
iString
!=
-
1
;
}
/***********************************************************************
* TOOLBAR_CheckStyle
...
...
@@ -3203,6 +3208,8 @@ TOOLBAR_DeleteButton (TOOLBAR_INFO *infoPtr, INT nIndex)
if
(
infoPtr
->
nNumButtons
==
1
)
{
TRACE
(
" simple delete!
\n
"
);
if
(
TOOLBAR_ButtonHasString
(
infoPtr
->
buttons
))
Free
((
LPWSTR
)
infoPtr
->
buttons
[
0
].
iString
);
Free
(
infoPtr
->
buttons
);
infoPtr
->
buttons
=
NULL
;
infoPtr
->
nNumButtons
=
0
;
...
...
@@ -3223,6 +3230,8 @@ TOOLBAR_DeleteButton (TOOLBAR_INFO *infoPtr, INT nIndex)
(
infoPtr
->
nNumButtons
-
nIndex
)
*
sizeof
(
TBUTTON_INFO
));
}
if
(
TOOLBAR_ButtonHasString
(
oldButtons
))
Free
((
LPWSTR
)
oldButtons
->
iString
);
Free
(
oldButtons
);
}
...
...
@@ -4331,11 +4340,10 @@ TOOLBAR_SetButtonInfoA (TOOLBAR_INFO *infoPtr, INT Id, const TBBUTTONINFOA *lptb
btnPtr
->
fsStyle
=
lptbbi
->
fsStyle
;
if
((
lptbbi
->
dwMask
&
TBIF_TEXT
)
&&
((
INT_PTR
)
lptbbi
->
pszText
!=
-
1
))
{
if
((
HIWORD
(
btnPtr
->
iString
)
==
0
)
||
(
btnPtr
->
iString
==
-
1
))
/* iString is index, zero it to make Str_SetPtr succeed */
btnPtr
->
iString
=
0
;
/* iString is index, zero it to make Str_SetPtr succeed */
if
(
!
TOOLBAR_ButtonHasString
(
btnPtr
))
btnPtr
->
iString
=
0
;
Str_SetPtrAtoW
((
LPWSTR
*
)
&
btnPtr
->
iString
,
lptbbi
->
pszText
);
Str_SetPtrAtoW
((
LPWSTR
*
)
&
btnPtr
->
iString
,
lptbbi
->
pszText
);
}
/* save the button rect to see if we need to redraw the whole toolbar */
...
...
@@ -4382,9 +4390,9 @@ TOOLBAR_SetButtonInfoW (TOOLBAR_INFO *infoPtr, INT Id, const TBBUTTONINFOW *lptb
btnPtr
->
fsStyle
=
lptbbi
->
fsStyle
;
if
((
lptbbi
->
dwMask
&
TBIF_TEXT
)
&&
((
INT_PTR
)
lptbbi
->
pszText
!=
-
1
))
{
if
((
HIWORD
(
btnPtr
->
iString
)
==
0
)
||
(
btnPtr
->
iString
==
-
1
))
/* iString is index, zero it to make Str_SetPtr succeed */
btnPtr
->
iString
=
0
;
/* iString is index, zero it to make Str_SetPtr succeed */
if
(
!
TOOLBAR_ButtonHasString
(
btnPtr
))
btnPtr
->
iString
=
0
;
Str_SetPtrW
((
LPWSTR
*
)
&
btnPtr
->
iString
,
lptbbi
->
pszText
);
}
...
...
@@ -5222,6 +5230,8 @@ TOOLBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
static
LRESULT
TOOLBAR_Destroy
(
TOOLBAR_INFO
*
infoPtr
)
{
INT
i
;
/* delete tooltip control */
if
(
infoPtr
->
hwndToolTip
)
DestroyWindow
(
infoPtr
->
hwndToolTip
);
...
...
@@ -5231,11 +5241,13 @@ TOOLBAR_Destroy (TOOLBAR_INFO *infoPtr)
Free
(
infoPtr
->
bitmaps
);
/* bitmaps list */
/* delete button data */
for
(
i
=
0
;
i
<
infoPtr
->
nNumButtons
;
i
++
)
if
(
TOOLBAR_ButtonHasString
(
&
infoPtr
->
buttons
[
i
]))
Free
((
LPWSTR
)
infoPtr
->
buttons
[
i
].
iString
);
Free
(
infoPtr
->
buttons
);
/* delete strings */
if
(
infoPtr
->
strings
)
{
INT
i
;
for
(
i
=
0
;
i
<
infoPtr
->
nNumStrings
;
i
++
)
Free
(
infoPtr
->
strings
[
i
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment