* don't leak fTrack

* fixed broken while loop
* call _InitObject also from the archive constructor
* just noticed while trying to load the R5 epson printer driver, still not working...



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26275 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich
2008-07-06 10:26:14 +00:00
parent f589ec0229
commit cd6265ec4d
+5 -16
View File
@@ -91,30 +91,18 @@ BListView::BListView(BMessage* archive)
: BView(archive) : BView(archive)
{ {
int32 listType; int32 listType;
archive->FindInt32("_lv_type", &listType); archive->FindInt32("_lv_type", &listType);
fListType = (list_view_type)listType; _InitObject((list_view_type)listType);
fFirstSelected = -1;
fLastSelected = -1;
fAnchorIndex = -1;
fSelectMessage = NULL;
fScrollView = NULL;
fTrack = NULL;
int32 i = 0; int32 i = 0;
BMessage subData; BMessage subData;
while (archive->FindMessage("_l_items", i++, &subData) == B_OK) {
while (archive->FindMessage("_l_items", i++, &subData)) {
BArchivable *object = instantiate_object(&subData); BArchivable *object = instantiate_object(&subData);
if (!object) if (!object)
continue; continue;
BListItem *item = dynamic_cast<BListItem*>(object); BListItem *item = dynamic_cast<BListItem*>(object);
if (!item) if (item)
continue;
AddItem(item); AddItem(item);
} }
@@ -136,6 +124,7 @@ BListView::BListView(BMessage* archive)
BListView::~BListView() BListView::~BListView()
{ {
delete fTrack;
SetSelectionMessage(NULL); SetSelectionMessage(NULL);
} }
@@ -1459,7 +1448,7 @@ BListView::_TryInitiateDrag(BPoint where)
if (dragDistance > 5.0) { if (dragDistance > 5.0) {
fTrack->try_drag = false; fTrack->try_drag = false;
return InitiateDrag(fTrack->drag_start, fTrack->item_index, fTrack->was_selected);; return InitiateDrag(fTrack->drag_start, fTrack->item_index, fTrack->was_selected);
} }
return false; return false;
} }