Remove jwidget_free() function.

This commit is contained in:
David Capello 2012-04-15 16:04:03 -03:00
parent 44856735be
commit 48f0a88d66
11 changed files with 17 additions and 25 deletions

View File

@ -309,13 +309,13 @@ int App::run()
// Delete all editors first because they used signals from other
// widgets (e.g. color bar).
jwidget_free(box_editors);
delete box_editors;
// Destroy mini-editor.
exit_module_editors();
// Destroy the top-window
jwidget_free(top_window);
delete top_window;
top_window = NULL;
}

View File

@ -61,7 +61,7 @@ static bool brush_type_change_hook(JWidget widget, void *data);
static void on_exit_delete_this_widget()
{
ASSERT(window != NULL);
jwidget_free(window);
delete window;
}
static void on_pen_size_after_change()
@ -251,7 +251,7 @@ void ConfigureTools::onExecute(Context* context)
"onionskin", &m_onionSkin, NULL);
}
catch (...) {
jwidget_free(window);
delete window;
window = NULL;
throw;
}

View File

@ -95,7 +95,7 @@ private:
JI_LIST_FOR_EACH_SAFE(m_stockListBox->children, link, next) {
Widget* listitem = reinterpret_cast<Widget*>(link->data);
m_stockListBox->removeChild(listitem);
jwidget_free(listitem);
delete listitem;
}
for (ConvolutionMatrixStock::iterator it = m_stock.begin(), end = m_stock.end();

View File

@ -112,7 +112,7 @@ FilterTargetButtons::FilterTargetButtons(int imgtype, bool withChannels)
if (withChannels)
addChild(hbox);
else
jwidget_free(hbox);
delete hbox;
ADD(this, index, onChannelChange);
ADD(this, images, onImagesChange);

View File

@ -391,7 +391,7 @@ again:
lastpath.c_str());
}
jwidget_free(window);
delete window;
window = NULL;
return result;

View File

@ -142,7 +142,7 @@ MenuItem::~MenuItem()
jaccel_free(m_accel);
if (m_submenu)
jwidget_free(m_submenu);
delete m_submenu;
}
Menu* MenuBox::getMenu()
@ -264,7 +264,7 @@ void Menu::showPopup(int x, int y)
menubox->setMenu(NULL);
// Destroy the window
jwidget_free(window);
delete window;
}
bool Menu::onProcessMessage(Message* msg)
@ -828,7 +828,7 @@ bool MenuItem::onProcessMessage(Message* msg)
window = (Frame*)menubox->parent;
ASSERT(window && window->type == JI_FRAME);
// Fetch the "menu" to avoid free it with 'jwidget_free()'
// Fetch the "menu" to avoid destroy it with 'delete'.
menubox->setMenu(NULL);
// Destroy the window
@ -840,9 +840,9 @@ bool MenuItem::onProcessMessage(Message* msg)
else
getManager()->setFocus(this->parent->parent);
// Is not necessary to free this window because it's
// It is not necessary to delete this window because it's
// automatically destroyed by the manager
// ... jwidget_free(window);
// ... delete window;
if (last_of_close_chain) {
base->close_all = false;

View File

@ -32,7 +32,7 @@ PopupFrame::PopupFrame(const char* text, bool close_on_buttonpressed)
// remove decorative widgets
JLink link, next;
JI_LIST_FOR_EACH_SAFE(this->children, link, next)
jwidget_free(reinterpret_cast<JWidget>(link->data));
delete reinterpret_cast<Widget*>(link->data);
initTheme();
jwidget_noborders(this);

View File

@ -183,7 +183,7 @@ TipWindow::TipWindow(const char *text, bool close_on_buttonpressed)
// remove decorative widgets
JI_LIST_FOR_EACH_SAFE(this->children, link, next)
jwidget_free(reinterpret_cast<JWidget>(link->data));
delete reinterpret_cast<Widget*>(link->data);
initTheme();
}

View File

@ -85,12 +85,6 @@ Widget::Widget(int type)
m_doubleBuffered = false;
}
void jwidget_free(JWidget widget)
{
ASSERT_VALID_WIDGET(widget);
delete widget;
}
Widget::~Widget()
{
JLink link, next;
@ -115,7 +109,7 @@ Widget::~Widget()
/* remove children */
JI_LIST_FOR_EACH_SAFE(this->children, link, next)
jwidget_free(reinterpret_cast<JWidget>(link->data));
delete reinterpret_cast<Widget*>(link->data);
jlist_free(this->children);
/* destroy the update region */

View File

@ -38,8 +38,6 @@ typedef std::vector<Widget*> WidgetsList;
int ji_register_widget_type();
void jwidget_free(JWidget widget);
/* hooks */
void jwidget_add_hook(JWidget widget, int type,

View File

@ -473,14 +473,14 @@ void close_editor(Editor* editor)
// Remove this editor.
parent_box->removeChild(view);
jwidget_free(view);
delete view;
// Fixup the parent.
other_widget = reinterpret_cast<JWidget>(jlist_first_data(parent_box->children));
parent_box->removeChild(other_widget);
parent_box->getParent()->replaceChild(parent_box, other_widget);
jwidget_free(parent_box);
delete parent_box;
// Find next editor to select.
if (!current_editor) {