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
57200073
Commit
57200073
authored
Dec 10, 2002
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Dec 10, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Plug a bunch of memory leaks.
- Make ranges_destroy behave more like free(). - Fix messed up indentation from tabs set to 4 chars. - Updated the documentation.
parent
50bd40c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
20 deletions
+33
-20
listview.c
dlls/comctl32/listview.c
+33
-20
No files found.
dlls/comctl32/listview.c
View file @
57200073
...
@@ -45,13 +45,15 @@
...
@@ -45,13 +45,15 @@
* -- LVA_SNAPTOGRID not implemented
* -- LVA_SNAPTOGRID not implemented
* -- LISTVIEW_ApproximateViewRect partially implemented
* -- LISTVIEW_ApproximateViewRect partially implemented
* -- LISTVIEW_[GS]etColumnOrderArray stubs
* -- LISTVIEW_[GS]etColumnOrderArray stubs
* -- LISTVIEW_GetNextItem is very inefficient
* -- LISTVIEW_SetColumnWidth ignores header images & bitmap
* -- LISTVIEW_SetColumnWidth ignores header images & bitmap
* -- LISTVIEW_SetIconSpacing is incomplete
* -- LISTVIEW_SetIconSpacing is incomplete
* -- LISTVIEW_SortItems is broken
* -- LISTVIEW_SortItems is broken
* -- LISTVIEW_StyleChanged doesn't handle some changes too well
* -- LISTVIEW_StyleChanged doesn't handle some changes too well
*
*
* Speedups
* Speedups
* -- LISTVIEW_GetNextItem needs to be rewritten. It is currently
* linear in the number of items in the list, and this is
* unacceptable for large lists.
* -- in sorted mode, LISTVIEW_InsertItemT sorts the array,
* -- in sorted mode, LISTVIEW_InsertItemT sorts the array,
* instead of inserting in the right spot
* instead of inserting in the right spot
* -- we should keep an ordered array of coordinates in iconic mode
* -- we should keep an ordered array of coordinates in iconic mode
...
@@ -785,16 +787,16 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML
...
@@ -785,16 +787,16 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML
if
(
convertToAnsi
)
if
(
convertToAnsi
)
{
{
if
(
notificationCode
!=
LVN_GETDISPINFOW
)
if
(
notificationCode
!=
LVN_GETDISPINFOW
)
{
{
cchTempBufMax
=
WideCharToMultiByte
(
CP_ACP
,
0
,
pdi
->
item
.
pszText
,
cchTempBufMax
=
WideCharToMultiByte
(
CP_ACP
,
0
,
pdi
->
item
.
pszText
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
-
1
,
NULL
,
0
,
NULL
,
NULL
);
}
}
else
else
{
{
cchTempBufMax
=
pdi
->
item
.
cchTextMax
;
cchTempBufMax
=
pdi
->
item
.
cchTextMax
;
*
pdi
->
item
.
pszText
=
0
;
/* make sure we don't process garbage */
*
pdi
->
item
.
pszText
=
0
;
/* make sure we don't process garbage */
}
}
pszTempBuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CHAR
)
*
pszTempBuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CHAR
)
*
cchTempBufMax
);
cchTempBufMax
);
...
@@ -1016,7 +1018,7 @@ static RANGE iterator_range(ITERATOR* i)
...
@@ -1016,7 +1018,7 @@ static RANGE iterator_range(ITERATOR* i)
*/
*/
static
inline
void
iterator_destroy
(
ITERATOR
*
i
)
static
inline
void
iterator_destroy
(
ITERATOR
*
i
)
{
{
if
(
i
->
ranges
)
ranges_destroy
(
i
->
ranges
);
ranges_destroy
(
i
->
ranges
);
}
}
/***
/***
...
@@ -2423,6 +2425,7 @@ static void ranges_clear(RANGES ranges)
...
@@ -2423,6 +2425,7 @@ static void ranges_clear(RANGES ranges)
static
void
ranges_destroy
(
RANGES
ranges
)
static
void
ranges_destroy
(
RANGES
ranges
)
{
{
if
(
!
ranges
)
return
;
ranges_clear
(
ranges
);
ranges_clear
(
ranges
);
DPA_Destroy
(
ranges
->
hdpa
);
DPA_Destroy
(
ranges
->
hdpa
);
COMCTL32_Free
(
ranges
);
COMCTL32_Free
(
ranges
);
...
@@ -2446,7 +2449,7 @@ static RANGES ranges_clone(RANGES ranges)
...
@@ -2446,7 +2449,7 @@ static RANGES ranges_clone(RANGES ranges)
fail:
fail:
TRACE
(
"clone failed
\n
"
);
TRACE
(
"clone failed
\n
"
);
if
(
clone
)
ranges_destroy
(
clone
);
ranges_destroy
(
clone
);
return
NULL
;
return
NULL
;
}
}
...
@@ -7013,6 +7016,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
...
@@ -7013,6 +7016,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
WS_CHILD
|
HDS_HORZ
|
(
DWORD
)((
LVS_NOSORTHEADER
&
lpcs
->
style
)
?
0
:
HDS_BUTTONS
),
WS_CHILD
|
HDS_HORZ
|
(
DWORD
)((
LVS_NOSORTHEADER
&
lpcs
->
style
)
?
0
:
HDS_BUTTONS
),
0
,
0
,
0
,
0
,
hwnd
,
NULL
,
0
,
0
,
0
,
0
,
hwnd
,
NULL
,
lpcs
->
hInstance
,
NULL
);
lpcs
->
hInstance
,
NULL
);
if
(
!
infoPtr
->
hwndHeader
)
goto
fail
;
/* set header unicode format */
/* set header unicode format */
SendMessageW
(
infoPtr
->
hwndHeader
,
HDM_SETUNICODEFORMAT
,
(
WPARAM
)
TRUE
,
(
LPARAM
)
NULL
);
SendMessageW
(
infoPtr
->
hwndHeader
,
HDM_SETUNICODEFORMAT
,
(
WPARAM
)
TRUE
,
(
LPARAM
)
NULL
);
...
@@ -7020,15 +7024,12 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
...
@@ -7020,15 +7024,12 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
/* set header font */
/* set header font */
SendMessageW
(
infoPtr
->
hwndHeader
,
WM_SETFONT
,
(
WPARAM
)
infoPtr
->
hFont
,
(
LPARAM
)
TRUE
);
SendMessageW
(
infoPtr
->
hwndHeader
,
WM_SETFONT
,
(
WPARAM
)
infoPtr
->
hFont
,
(
LPARAM
)
TRUE
);
/* allocate memory for the selection ranges */
if
(
!
(
infoPtr
->
selectionRanges
=
ranges_create
(
10
)))
return
-
1
;
/* allocate memory for the data structure */
/* allocate memory for the data structure */
/* FIXME: what if we fail? */
if
(
!
(
infoPtr
->
selectionRanges
=
ranges_create
(
10
)))
goto
fail
;
i
nfoPtr
->
hdpaItems
=
DPA_Create
(
10
)
;
i
f
(
!
(
infoPtr
->
hdpaItems
=
DPA_Create
(
10
)))
goto
fail
;
i
nfoPtr
->
hdpaPosX
=
DPA_Create
(
10
)
;
i
f
(
!
(
infoPtr
->
hdpaPosX
=
DPA_Create
(
10
)))
goto
fail
;
i
nfoPtr
->
hdpaPosY
=
DPA_Create
(
10
)
;
i
f
(
!
(
infoPtr
->
hdpaPosY
=
DPA_Create
(
10
)))
goto
fail
;
i
nfoPtr
->
hdpaColumns
=
DPA_Create
(
10
)
;
i
f
(
!
(
infoPtr
->
hdpaColumns
=
DPA_Create
(
10
)))
goto
fail
;
/* initialize the icon sizes */
/* initialize the icon sizes */
set_icon_size
(
&
infoPtr
->
iconSize
,
infoPtr
->
himlNormal
,
uView
!=
LVS_ICON
);
set_icon_size
(
&
infoPtr
->
iconSize
,
infoPtr
->
himlNormal
,
uView
!=
LVS_ICON
);
...
@@ -7052,6 +7053,16 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
...
@@ -7052,6 +7053,16 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
}
}
return
0
;
return
0
;
fail:
DestroyWindow
(
infoPtr
->
hwndHeader
);
ranges_destroy
(
infoPtr
->
selectionRanges
);
DPA_Destroy
(
infoPtr
->
hdpaItems
);
DPA_Destroy
(
infoPtr
->
hdpaPosX
);
DPA_Destroy
(
infoPtr
->
hdpaPosY
);
DPA_Destroy
(
infoPtr
->
hdpaColumns
);
COMCTL32_Free
(
infoPtr
);
return
-
1
;
}
}
/***
/***
...
@@ -7656,7 +7667,10 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
...
@@ -7656,7 +7667,10 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
/* destroy data structure */
/* destroy data structure */
DPA_Destroy
(
infoPtr
->
hdpaItems
);
DPA_Destroy
(
infoPtr
->
hdpaItems
);
if
(
infoPtr
->
selectionRanges
)
ranges_destroy
(
infoPtr
->
selectionRanges
);
DPA_Destroy
(
infoPtr
->
hdpaPosX
);
DPA_Destroy
(
infoPtr
->
hdpaPosY
);
DPA_Destroy
(
infoPtr
->
hdpaColumns
);
ranges_destroy
(
infoPtr
->
selectionRanges
);
/* destroy image lists */
/* destroy image lists */
if
(
!
(
infoPtr
->
dwStyle
&
LVS_SHAREIMAGELISTS
))
if
(
!
(
infoPtr
->
dwStyle
&
LVS_SHAREIMAGELISTS
))
...
@@ -8726,7 +8740,6 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
...
@@ -8726,7 +8740,6 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
{
SetWindowPos
(
infoPtr
->
hwndSelf
,
0
,
0
,
0
,
0
,
0
,
SWP_FRAMECHANGED
|
SWP_NOACTIVATE
|
SetWindowPos
(
infoPtr
->
hwndSelf
,
0
,
0
,
0
,
0
,
0
,
SWP_FRAMECHANGED
|
SWP_NOACTIVATE
|
SWP_NOZORDER
|
SWP_NOMOVE
|
SWP_NOSIZE
);
SWP_NOZORDER
|
SWP_NOMOVE
|
SWP_NOSIZE
);
/* FIXME: why do we need this here? */
LISTVIEW_UpdateSize
(
infoPtr
);
LISTVIEW_UpdateSize
(
infoPtr
);
LISTVIEW_UpdateScroll
(
infoPtr
);
LISTVIEW_UpdateScroll
(
infoPtr
);
}
}
...
...
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