Skip to content

Commit

Permalink
BrushStoreWindow: delay drawing until all brushes are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
dsizzle committed Nov 8, 2023
1 parent abd98a1 commit a77b587
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions artpaint/windows/BrushStoreWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,22 +240,26 @@ BrushStoreWindow::brush_adder(void* data)
{
BrushStoreWindow* this_pointer = (BrushStoreWindow*)data;

this_pointer->Lock();
this_pointer->BeginViewTransaction();
if (this_pointer != NULL) {
BList temp_list(*brush_data);
if (temp_list.CountItems() > 0) {
Brush* a_brush = new Brush(*(brush_info*)(temp_list.ItemAt(0)));

for (int32 i = 0; i < temp_list.CountItems(); i++) {
a_brush->ModifyBrush(*(brush_info*)(temp_list.ItemAt(i)));
this_pointer->Lock();
this_pointer->store_view->AddBrush(a_brush);
this_pointer->Unlock();
}

delete a_brush;
}
this_pointer->EndViewTransaction();
this_pointer->Unlock();
return B_OK;
}
this_pointer->EndViewTransaction();
this_pointer->Unlock();
return B_ERROR;
}

Expand Down

2 comments on commit a77b587

@korli
Copy link
Contributor

@korli korli commented on a77b587 Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@humdingerb this_pointer->Lock(); this_pointer->BeginViewTransaction(); should be moved in the if block. this_pointer can't be NULL when calling Lock(). The two calls before return B_ERROR; are then to be removed.

@humdingerb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change. Still works... :)

Please sign in to comment.