Bug: The window example called a callback method after child data was deleted

This commit is contained in:
Markus Gans 2017-11-03 22:57:40 +01:00
parent 1bf4f2f906
commit aa4caf4fcb
4 changed files with 15 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2017-11-03 Markus Gans <guru.mail@muenster.de>
* Small NewFont improvements
* Fixed bug: The window example called a callback method after
the child data was deleted
2017-11-02 Markus Gans <guru.mail@muenster.de>
* Move fonts into the root directory

View File

@ -114,7 +114,11 @@ SmallWindow::SmallWindow (FWidget* parent)
//----------------------------------------------------------------------
SmallWindow::~SmallWindow()
{
// Remove own timer
delOwnTimer();
// Remove all callbacks before Window::cb_destroyWindow() will be called
delCallbacks();
}
//----------------------------------------------------------------------
@ -183,7 +187,7 @@ class Window : public FDialog
{
bool is_open;
FString* title;
FDialog* dgl;
SmallWindow* dgl;
}
win_data;
@ -416,7 +420,7 @@ void Window::cb_createWindows (FWidget*, data_ptr)
if ( ! (*iter)->is_open )
{
win_data* win_dat = *iter;
FDialog* win = new SmallWindow(this);
SmallWindow* win = new SmallWindow(this);
win_dat->dgl = win;
win_dat->is_open = true;
win->setText(*(win_dat)->title);

View File

@ -1555,7 +1555,7 @@ void FListView::drawColumnLabels()
first = h.begin() + xoffset;
if ( int(h.size()) <= getClientWidth() )
last = h.end();// - 1;
last = h.end();
else
{
int len = getClientWidth() + xoffset - 1;

View File

@ -114,6 +114,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
FWidget::~FWidget() // destructor
{
processDestroy();
delCallbacks();
FApplication::removeQueuedEvent(this);
// unset clicked widget
@ -1003,7 +1004,7 @@ void FWidget::delCallback (FWidget* cb_instance)
}
//----------------------------------------------------------------------
inline void FWidget::delCallbacks()
void FWidget::delCallbacks()
{
// delete all callbacks from this widget