Navigation Menu

Skip to content

Commit

Permalink
Dont leave dangling references between ScrollBar and other controls
Browse files Browse the repository at this point in the history
  • Loading branch information
bradallred committed Mar 2, 2015
1 parent e38aa49 commit a1e90d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions gemrb/core/GUI/Control.cpp
Expand Up @@ -64,6 +64,7 @@ Control::Control(const Region& frame)

Control::~Control()
{
SetScrollBar(NULL);
if (InHandler) {
Log(ERROR, "Control", "Destroying control inside event handler, crash may occur!");
}
Expand Down
3 changes: 3 additions & 0 deletions gemrb/core/GUI/ScrollBar.cpp
Expand Up @@ -57,6 +57,9 @@ ScrollBar::ScrollBar(const Region& frame, Sprite2D* images[IE_SCROLLBAR_IMAGE_CO

ScrollBar::~ScrollBar(void)
{
if (ta) {
ta->SetScrollBar(NULL);
}
for(int i=0; i < IE_SCROLLBAR_IMAGE_COUNT; i++) {
Sprite2D::FreeSprite(Frames[i]);
}
Expand Down

0 comments on commit a1e90d0

Please sign in to comment.