FObject double free prevention of fc::empty_string

This commit is contained in:
Markus Gans 2017-10-15 23:22:13 +02:00
parent af2caf8fcf
commit 1cb6a5f73d
5 changed files with 43 additions and 45 deletions

View File

@ -1,3 +1,6 @@
2017-10-15 Markus Gans <guru.mail@muenster.de>
* FObject double free prevention of fc::empty_string
2017-10-14 Markus Gans <guru.mail@muenster.de>
* Fixed a bug in the FObject check of parent objects
* Replace the deprecated readdir_r function (CVE-2013-4237)

View File

@ -182,11 +182,11 @@ void Listview::cb_showInMessagebox (FWidget* widget, data_ptr)
{
FListView* listView = static_cast<FListView*>(widget);
FListViewItem* item = listView->getCurrentItem();
FMessageBox info ( "Weather in " + item->getText(0)
, " Condition: " + item->getText(1) + "\n"
"Temperature: " + item->getText(2) + "\n"
" Humidity: " + item->getText(3) + "\n"
" Pressure: " + item->getText(4)
FMessageBox info ( "Weather in " + item->getText(1)
, " Condition: " + item->getText(2) + "\n"
"Temperature: " + item->getText(3) + "\n"
" Humidity: " + item->getText(4) + "\n"
" Pressure: " + item->getText(5)
, FMessageBox::Ok, 0, 0, this );
info.show();
}

View File

@ -266,12 +266,6 @@ Treeview::Treeview (FWidget* parent)
continent_list++;
}
FObjectIterator iter = listView->beginOfList();
FObjectIterator iter_africa = iter++;
FListViewItem* item_africa = static_cast<FListViewItem*>(*iter_africa);
item_africa->expand();
// Quit button
Quit = new FButton (this);
Quit->setGeometry(24, 16, 10, 1);

View File

@ -38,10 +38,12 @@ FObject::FObject (FObject* parent)
, children_list() // no children yet
, has_parent(false)
{
if ( parent_obj ) // add object to parent
parent_obj->addChild(this);
if ( parent == 0 )
if ( parent ) // add object to parent
{
parent->addChild(this);
has_parent = true;
}
else
{
timer_modify_lock = false;
@ -71,17 +73,11 @@ FObject::FObject (FObject* parent)
}
}
}
else
has_parent = true;
}
//----------------------------------------------------------------------
FObject::~FObject() // destructor
{
if ( parent_obj )
parent_obj->delChild(this);
parent_obj = 0;
delOwnTimer(); // delete all timers of this object
if ( ! has_parent && timer_list )
@ -110,6 +106,11 @@ FObject::~FObject() // destructor
++iter;
}
}
if ( parent_obj )
parent_obj->delChild(this);
parent_obj = 0;
}
// public methods of FObject

View File

@ -2482,13 +2482,13 @@ inline void FString::_assign (const wchar_t* s)
//----------------------------------------------------------------------
inline void FString::_insert (uInt pos, uInt len, const wchar_t* s)
{
if ( len == 0 ) // String s is a null or a empty string
return;
if ( ! string )
{
// string is null
if ( len == 0 ) // String s is also a null string
return;
length = len;
bufsize = FWDBUFFER + length + 1;