diff --git a/src/app.cpp b/src/app.cpp index 644d385a3..669109eeb 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -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; } diff --git a/src/commands/cmd_configure_tools.cpp b/src/commands/cmd_configure_tools.cpp index 7be2518b0..3b1141793 100644 --- a/src/commands/cmd_configure_tools.cpp +++ b/src/commands/cmd_configure_tools.cpp @@ -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; } diff --git a/src/commands/filters/cmd_convolution_matrix.cpp b/src/commands/filters/cmd_convolution_matrix.cpp index 452b4f68a..0ec54fd27 100644 --- a/src/commands/filters/cmd_convolution_matrix.cpp +++ b/src/commands/filters/cmd_convolution_matrix.cpp @@ -95,7 +95,7 @@ private: JI_LIST_FOR_EACH_SAFE(m_stockListBox->children, link, next) { Widget* listitem = reinterpret_cast(link->data); m_stockListBox->removeChild(listitem); - jwidget_free(listitem); + delete listitem; } for (ConvolutionMatrixStock::iterator it = m_stock.begin(), end = m_stock.end(); diff --git a/src/commands/filters/filter_target_buttons.cpp b/src/commands/filters/filter_target_buttons.cpp index d1c978563..bc61a8da6 100644 --- a/src/commands/filters/filter_target_buttons.cpp +++ b/src/commands/filters/filter_target_buttons.cpp @@ -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); diff --git a/src/dialogs/filesel.cpp b/src/dialogs/filesel.cpp index cb8567c3f..5b51aba52 100644 --- a/src/dialogs/filesel.cpp +++ b/src/dialogs/filesel.cpp @@ -391,7 +391,7 @@ again: lastpath.c_str()); } - jwidget_free(window); + delete window; window = NULL; return result; diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index a10c9b1c2..3f5d86043 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -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; diff --git a/src/gui/popup_frame.cpp b/src/gui/popup_frame.cpp index 68348c13e..28093019b 100644 --- a/src/gui/popup_frame.cpp +++ b/src/gui/popup_frame.cpp @@ -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(link->data)); + delete reinterpret_cast(link->data); initTheme(); jwidget_noborders(this); diff --git a/src/gui/tooltips.cpp b/src/gui/tooltips.cpp index c25bf69ee..896cf91db 100644 --- a/src/gui/tooltips.cpp +++ b/src/gui/tooltips.cpp @@ -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(link->data)); + delete reinterpret_cast(link->data); initTheme(); } diff --git a/src/gui/widget.cpp b/src/gui/widget.cpp index ac37e0d57..01339521c 100644 --- a/src/gui/widget.cpp +++ b/src/gui/widget.cpp @@ -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(link->data)); + delete reinterpret_cast(link->data); jlist_free(this->children); /* destroy the update region */ diff --git a/src/gui/widget.h b/src/gui/widget.h index df98e0e86..2dafef757 100644 --- a/src/gui/widget.h +++ b/src/gui/widget.h @@ -38,8 +38,6 @@ typedef std::vector WidgetsList; int ji_register_widget_type(); -void jwidget_free(JWidget widget); - /* hooks */ void jwidget_add_hook(JWidget widget, int type, diff --git a/src/modules/editors.cpp b/src/modules/editors.cpp index 2f53ccf43..ee4a4010b 100644 --- a/src/modules/editors.cpp +++ b/src/modules/editors.cpp @@ -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(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) {