GithubHelp home page GithubHelp logo

TreeModel::get_path causes seg fault about gtk HOT 8 CLOSED

gtk-rs avatar gtk-rs commented on August 28, 2024
TreeModel::get_path causes seg fault

from gtk.

Comments (8)

GuillaumeGomez avatar GuillaumeGomez commented on August 28, 2024

I have a problem on the TreeModel too. @gkoz and I took a look but we couldn't find the problem. My problem is on the processus_viewer project. So your help is very welcome ! =D

from gtk.

gkoz avatar gkoz commented on August 28, 2024

To reproduce, simply add the following line in the first for loop of the treeview example:
left_model.get_path(&iter);

Could you paste a diff so we would be on the same page here? I'm failing to reproduce this so far. I do have a feeling though that the iterators aren't always handled correctly.

from gtk.

oakes avatar oakes commented on August 28, 2024
diff --git a/src/treeview.rs b/src/treeview.rs
index 22dc6ef..81ab5ef 100644
--- a/src/treeview.rs
+++ b/src/treeview.rs
@@ -54,6 +54,7 @@ fn main() {
         let mut iter = gtk::TreeIter::new().unwrap();
         left_store.append(&mut iter);
         left_store.set_string(&iter, 0, "I'm in a list");
+        left_model.get_path(&iter);
     }

     // right pane

from gtk.

GuillaumeGomez avatar GuillaumeGomez commented on August 28, 2024

@gkoz: I think that's the problem we've got here.

from gtk.

gkoz avatar gkoz commented on August 28, 2024

Thanks. Yeah, I see it too.

from gtk.

GuillaumeGomez avatar GuillaumeGomez commented on August 28, 2024

I think a g_object_ref is missing somewhere, causing the unwanted destruction of the object.

from gtk.

gkoz avatar gkoz commented on August 28, 2024

Reduced failing code:

extern crate glib;
extern crate gtk;

use gtk::traits::*;

fn main() {
    gtk::init();

    let column_types = [glib::Type::String];
    let left_store = gtk::ListStore::new(&column_types).unwrap();
    let left_model = left_store.get_model().unwrap();
    let mut iter = gtk::TreeIter::new().unwrap();
    left_store.append(&mut iter);
    left_model.get_path(&iter);
}

I'll try the same in C.

from gtk.

gkoz avatar gkoz commented on August 28, 2024

Okay, I guess the pointy hat goes to me for calling g_object_ref on a type that's not a GObject. :/

from gtk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.