|
@@ -61,6 +61,7 @@ ElementDataGridRow::~ElementDataGridRow()
|
|
|
if (data_source)
|
|
if (data_source)
|
|
|
{
|
|
{
|
|
|
data_source->DetachListener(this);
|
|
data_source->DetachListener(this);
|
|
|
|
|
+ data_source = NULL;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -109,8 +110,11 @@ int ElementDataGridRow::GetDepth()
|
|
|
|
|
|
|
|
void ElementDataGridRow::SetDataSource(const Rocket::Core::String& data_source_name)
|
|
void ElementDataGridRow::SetDataSource(const Rocket::Core::String& data_source_name)
|
|
|
{
|
|
{
|
|
|
- if (data_source)
|
|
|
|
|
|
|
+ if (data_source != NULL)
|
|
|
|
|
+ {
|
|
|
data_source->DetachListener(this);
|
|
data_source->DetachListener(this);
|
|
|
|
|
+ data_source = NULL;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (ParseDataSource(data_source, data_table, data_source_name))
|
|
if (ParseDataSource(data_source, data_table, data_source_name))
|
|
|
{
|
|
{
|
|
@@ -245,13 +249,13 @@ ElementDataGrid* ElementDataGridRow::GetParentGrid()
|
|
|
return parent_grid;
|
|
return parent_grid;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ElementDataGridRow::OnDataSourceDestroy(DataSource* ROCKET_UNUSED_PARAMETER(data_source))
|
|
|
|
|
|
|
+void ElementDataGridRow::OnDataSourceDestroy(DataSource* data_source)
|
|
|
{
|
|
{
|
|
|
- ROCKET_UNUSED(data_source);
|
|
|
|
|
-
|
|
|
|
|
- data_source->DetachListener(this);
|
|
|
|
|
- data_source = NULL;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(data_source != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ data_source->DetachListener(this);
|
|
|
|
|
+ data_source = NULL;
|
|
|
|
|
+ }
|
|
|
RemoveChildren();
|
|
RemoveChildren();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -286,7 +290,7 @@ void ElementDataGridRow::RefreshRows()
|
|
|
RemoveChildren();
|
|
RemoveChildren();
|
|
|
|
|
|
|
|
// Load the children from the data source.
|
|
// Load the children from the data source.
|
|
|
- if (data_source)
|
|
|
|
|
|
|
+ if (data_source != NULL)
|
|
|
{
|
|
{
|
|
|
int num_rows = data_source->GetNumRows(data_table);
|
|
int num_rows = data_source->GetNumRows(data_table);
|
|
|
if (num_rows > 0)
|
|
if (num_rows > 0)
|
|
@@ -370,7 +374,7 @@ void ElementDataGridRow::AddChildren(int first_row_added, int num_rows_added)
|
|
|
|
|
|
|
|
// We need to make a row for each new child, then pass through the cell
|
|
// We need to make a row for each new child, then pass through the cell
|
|
|
// information and the child's data source (if one exists.)
|
|
// information and the child's data source (if one exists.)
|
|
|
- if (data_source)
|
|
|
|
|
|
|
+ if (data_source != NULL)
|
|
|
{
|
|
{
|
|
|
for (int i = 0; i < num_rows_added; i++)
|
|
for (int i = 0; i < num_rows_added; i++)
|
|
|
{
|
|
{
|