diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-13 16:20:27 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-13 16:20:27 +0000 |
commit | 98506935a9ca52b1b083c0b3c08088becb52439e (patch) | |
tree | 7f8045c7e2d1fa28be3df1c4881226b477ef57cc /chrome/browser/autocomplete | |
parent | e52d98fc38c62558baa8507c0752ada8b520055d (diff) | |
download | chromium_src-98506935a9ca52b1b083c0b3c08088becb52439e.zip chromium_src-98506935a9ca52b1b083c0b3c08088becb52439e.tar.gz chromium_src-98506935a9ca52b1b083c0b3c08088becb52439e.tar.bz2 |
Cleanup AutocompleteEditViewGtk's resources and widgets.
Review URL: http://codereview.chromium.org/46034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index a47eb25..af8ac3fc 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -54,12 +54,31 @@ AutocompleteEditViewGtk::~AutocompleteEditViewGtk() { NotificationType::AUTOCOMPLETE_EDIT_DESTROYED, Source<AutocompleteEditViewGtk>(this), NotificationService::NoDetails()); + + // Explicitly teardown members which have a reference to us. Just to be safe + // we want them to be destroyed before destroying any other internal state. + popup_view_.release(); + model_.release(); + + // We own our widget and TextView related objects. + if (text_view_) { // Init() has been called. + gtk_widget_destroy(text_view_); + g_object_unref(text_buffer_); + g_object_unref(tag_table_); + g_object_unref(insecure_scheme_tag_); + g_object_unref(secure_scheme_tag_); + g_object_unref(base_tag_); + } } void AutocompleteEditViewGtk::Init() { + // The GtkTagTable and GtkTextBuffer are not initially unowned, so we have + // our own reference when we create them, and we own them. Adding them to + // the other objects adds a reference; it doesn't adopt them. tag_table_ = gtk_text_tag_table_new(); text_buffer_ = gtk_text_buffer_new(tag_table_); text_view_ = gtk_text_view_new_with_buffer(text_buffer_); + g_object_ref_sink(text_view_); // We want to own the widget. gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_view_), 4); gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text_view_), 4); |