Delayed widget editing, crash avoidance

Make the PoseView stop watching a TextWidget if it's being deleted.
Could happen in race conditions for example, if you click to edit
the name widget of a pose while the pose is being deleted soon after.
This commit is contained in:
Philippe Saint-Pierre 2012-08-10 12:08:45 -04:00
parent 44f900e221
commit 66c09a3554
3 changed files with 7 additions and 3 deletions

View File

@ -7137,9 +7137,10 @@ BPoseView::MouseDown(BPoint where)
void
BPoseView::SetTextWidgetToCheck(BTextWidget* widget)
BPoseView::SetTextWidgetToCheck(BTextWidget* widget, BTextWidget* old)
{
fTextWidgetToCheck = widget;
if (old == NULL || fTextWidgetToCheck == old)
fTextWidgetToCheck = widget;
}

View File

@ -425,7 +425,7 @@ class BPoseView : public BView {
virtual void AdaptToVolumeChange(BMessage*);
virtual void AdaptToDesktopIntegrationChange(BMessage*);
void SetTextWidgetToCheck(BTextWidget*);
void SetTextWidgetToCheck(BTextWidget*, BTextWidget* = NULL);
protected:
// view setup

View File

@ -78,6 +78,9 @@ BTextWidget::BTextWidget(Model* model, BColumn* column, BPoseView* view)
BTextWidget::~BTextWidget()
{
if (fLastClickedTime != 0)
fParams.poseView->SetTextWidgetToCheck(NULL, this);
delete fText;
}