Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:49:52+00:00 2026-05-27T20:49:52+00:00

I have following code to find if row is selected, which is selected and

  • 0

I have following code to find if row is selected, which is selected and which text is in row of GtkTreeView. Code is in key-release event handler.

char *ntext;
if (gtk_tree_selection_get_selected(treeselen, &modelen ,&iteren))
{
    gtk_tree_model_get(modelen, &iteren, cEng, &ntext, -1);
... etc...

This works ok when my view is not empty. But when list is empty I get “segmentation fault”.
I think that before this is needed to check if GtkTreeView is empty.

How to do that?

Actually, later I find if list is partially filled with clicking on unfilled area segfault happens too. So I need solution for that too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:49:53+00:00Added an answer on May 27, 2026 at 8:49 pm

    From your description, it appears when you say GtkTreeView is empty you mean in model (GtkTreeModel which is implemented by GtkListStore or GtkTreeStore associated with your GtkTreeView) the data rows are added but are empty i.e. data is not set. In that case you need to check the value returned by gtk_tree_model_get (assuming cEng is valid otherwise you will get a warning message while running the program). Problem mostly is in ...etc.... Just add a NULL check to ntext before operating on it.

    char *ntext;
    if (gtk_tree_selection_get_selected(treeselen, &modelen ,&iteren))
    {
        gtk_tree_model_get(modelen, &iteren, cEng, &ntext, -1);
        if( ntext == NULL )
        {
           printf("Data is NULL!\n");
           /* Handle this case */
        }
       else
       { 
         .... etc ....
       }
    }
    

    This could also be the case in you button-press or release callback as well.
    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to find out why the following lines of code do
I have following Code Block Which I tried to optimize in the Optimized section
I have the following code: $(.perf-row).click(function(e) { if (e.target.tagName.toLowerCase() == a) { pageTracker._trackPageview($(this).attr(rel)); return
Given this following sample code which clones a table row, sets some properties and
I have a problem accessing the 'event' in Firefox. The following code works fine
I have the following code. http://jsfiddle.net/CtMmT/4/ Now i need to remove the text from
I have the following code: Tag.find_all_by_company_id(4).each.collect{|tag| tag.name }.join(,) (Essentially I'm trying to build a
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following code in my application: // to set tip - photo in
I have following code in my Application. Comments in my code will specify My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.