473,545 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PyGTK TreeView segmentation fault on expand_all()

Good morning.

I have recently begun a project using PyGTK, and part of my planned
interface has a gtk.TreeView showing a portion of the filesystem. Now,
rather than load the entire FS structure into the tree right from the
beginning, I made a lazy tree by adding blank children to rows
representing directories, and connected a call to fill in the data when
a row with blank children was expanded.

Now, this works all fine and well, in general. I can browse my entire
filesystem this way. But I noticed that hitting '*' (which I believe is
a call to expand_all(), though the documentation does not say this
explicitly) on a row representing any empty directory causes a
segmentation fault.

This problem can be alleviated by not removing the blank child after
attempting to add directory contents, but I would like to avoid this
approach.

My suspicion is that expand_all() assumes that there are children
present, and when I remove the blank row (after attempting to add any
subdirectories and files), it does not check to make sure there are
still children.

So I suppose I have a couple questions. First, can anybody confirm my
suspicions? Secondly, is this a PyGTK bug, or am I doing something that
simply should never be done? Finally, do you see any way to fix this
problem?

Code follows
----------
def onExpand(self, view, iter, path):
"""Add directory contents on first expansion of its entry"""
sorted = view.get_model( ) # TreeModelSort
iter = sorted.convert_ iter_to_child_i ter(None,iter)
store = sorted.get_mode l() # TreeStore
child = store.iter_chil dren(iter)
cpath = store.get(iter, 1)[0][1:] # Hidden column with fs path
info
if store.get_value (child, 0) is None:
sorted.addDir(c path,iter)
store.remove(ch ild)

---------

If any other code is necessary, I can provide my entire program.
However, I think I've isolated the problem to that last line (execution
continues beyond it, so it's not exactly the line itself), and want to
hear any recommendations for how to still remove that blank child
without causing expand_all() to fall on its face.

Aug 7 '06 #1
0 1247

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3341
by: Samuele Giovanni Tonon | last post by:
hi, i'm trying to develop a trivial application which random copy files from a directory to another one. i made it using pygtk for the graphical interface, however i find some problem with progressbar and ListStore: basically i need to make pulse the progressbar while i'm copying files and write filenames copied on the ListStore on to...
0
2103
by: Franck Pommereau | last post by:
Hi all, I'm building a PyGTK interface in which I would like that no widget would be able to get the focus (and so to be activated by pressing the Return key). For this purpose, for each widget, I do: widget.set_property("can-focus", gtk.FALSE) My problem is a TreeView which has a clickable column, it get the default focus and I did...
0
1280
by: manatlan | last post by:
Hello, I'm new to pygtk (but i know wxpython very well) I'm trying to play with this example : http://www.pygtk.org/pygtk2tutorial/sec-CellRenderers.html#filelistingfig (the code is here : http://www.pygtk.org/pygtk2tutorial/examples/filelisting.py) I'd like to be able to use a virtual list (like wx.ListCtrl in mode LC_VIRTUAL) ...
3
11393
by: Zheng Da | last post by:
Program received signal SIGSEGV, Segmentation fault. 0x40093343 in _int_malloc () from /lib/tls/libc.so.6 (gdb) bt #0 0x40093343 in _int_malloc () from /lib/tls/libc.so.6 #1 0x40094c54 in malloc () from /lib/tls/libc.so.6 It's really strange; I just call malloc() like "tmp=malloc(size);" the system gives me Segmentation fault I want to...
5
2981
by: Fra-it | last post by:
Hi everybody, I'm trying to make the following code running properly, but I can't get rid of the "SEGMENTATION FAULT" error message when executing. Reading some messages posted earlier, I understood that a segmentation fault can occur whenever I declare a pointer and I leave it un-initialized. So I thought the problem here is with the (const...
18
26067
by: Digital Puer | last post by:
Hi, I'm coming over from Java to C++, so please bear with me. In C++, is there a way for me to use exceptions to catch segmentation faults (e.g. when I access a location off the end of an array)? Thanks.
27
3325
by: Paminu | last post by:
I have a wierd problem. In my main function I print "test" as the first thing. But if I run the call to node_alloc AFTER the printf call I get a segmentation fault and test is not printed! #include <stdlib.h> #include <stdio.h> typedef struct _node_t {
7
5861
by: pycraze | last post by:
I would like to ask a question. How do one handle the exception due to Segmentation fault due to Python ? Our bit operations and arithmetic manipulations are written in C and to some of our testcases we experiance Segmentation fault from the python libraries. If i know how to handle the exception for Segmentation fault , it will help me...
3
5142
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection from 10g release2 PHP is configured with the following parameters './configure' '--prefix=/opt/oracle/php' '--with-apxs=/opt/oracle/apache/bin/apxs'...
0
7502
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
744
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.