diff --git a/src/Layouts/DataBaseView.vala b/src/Layouts/DataBaseView.vala index dbc640fc..a325c9bf 100644 --- a/src/Layouts/DataBaseView.vala +++ b/src/Layouts/DataBaseView.vala @@ -52,6 +52,11 @@ public class Sequeler.Layouts.DataBaseView : Gtk.Grid { tabs.mode_changed.connect ((tab) => { stack.set_visible_child_name (tab.name); + + if (window.main.database_schema.source_list == null) { + return; + } + var item_selected = window.main.database_schema.source_list.selected; if (item_selected == null) { diff --git a/src/Layouts/Views/Content.vala b/src/Layouts/Views/Content.vala index 0c93b821..88cdfe38 100644 --- a/src/Layouts/Views/Content.vala +++ b/src/Layouts/Views/Content.vala @@ -136,9 +136,18 @@ public class Sequeler.Layouts.Views.Content : Gtk.Grid { } public void clear () { - if (scroll.get_child () != null) { - scroll.remove (scroll.get_child ()); + if (scroll == null) { + return; } + + scroll.destroy (); + + scroll = new Gtk.ScrolledWindow (null, null); + scroll.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC; + scroll.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC; + scroll.expand = true; + + attach (scroll, 0, 0, 1, 1); } public void reset () { diff --git a/src/Layouts/Views/Relations.vala b/src/Layouts/Views/Relations.vala index 0f637351..71004d9b 100644 --- a/src/Layouts/Views/Relations.vala +++ b/src/Layouts/Views/Relations.vala @@ -88,9 +88,18 @@ public class Sequeler.Layouts.Views.Relations : Gtk.Grid { } public void clear () { - if (scroll.get_child () != null) { - scroll.remove (scroll.get_child ()); + if (scroll == null) { + return; } + + scroll.destroy (); + + scroll = new Gtk.ScrolledWindow (null, null); + scroll.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC; + scroll.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC; + scroll.expand = true; + + attach (scroll, 0, 0, 1, 1); } public void reset () { diff --git a/src/Layouts/Views/Structure.vala b/src/Layouts/Views/Structure.vala index 00aee1e5..a806e813 100644 --- a/src/Layouts/Views/Structure.vala +++ b/src/Layouts/Views/Structure.vala @@ -88,9 +88,18 @@ public class Sequeler.Layouts.Views.Structure : Gtk.Grid { } public void clear () { - if (scroll.get_child () != null) { - scroll.remove (scroll.get_child ()); + if (scroll == null) { + return; } + + scroll.destroy (); + + scroll = new Gtk.ScrolledWindow (null, null); + scroll.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC; + scroll.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC; + scroll.expand = true; + + attach (scroll, 0, 0, 1, 1); } public void reset () {