# Bug in Gtk::EntryCompletion match-selected signal?

**URL:** <https://www.ruby-forum.com/t/bug-in-gtk-entrycompletion-match-selected-signal/112724>\
**Category:** Ruby-Gnome 2\
**Created:** [August 22, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/bug-in-gtk-entrycompletion-match-selected-signal/112724 "2007-08-22T16:38:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [August 22, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/bug-in-gtk-entrycompletion-match-selected-signal/112724/1 "2007-08-22T16:38:33Z")

</div>

The attached script bombs when an entry is selected from the list of  
completions (try entering a “T”). It seems that the iterator passed  
to the signal handler isn’t attached to the model properly. I have  
been unable to figure out why.

nikolai

---

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [August 22, 2007, 4:54pm UTC](https://www.ruby-forum.com/t/bug-in-gtk-entrycompletion-match-selected-signal/112724/2 "2007-08-22T16:54:35Z")

</div>

I had a similar problem a while ago (running against 0.16). IIRC, the  
error message said something about a GClosure object having been  
deleted due to reference counting. If you’re getting a similar  
message, this might be the problem.

I tried to fix the problem, but simply ran out of time. Fortunately,  
I was able to workaround the problem by keeping extending  
Gtk::Completion instance lifetime by assigning it to a member  
variable. In “setup\_completion”, try making “completion” a member  
(@completion) and see if the problem persists.

Hope this helps.  
Don Kelly/

On 8/22/07, Nikolai W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The attached script bombs when an entry is selected from the list of  
> completions (try entering a “T”). It seems that the iterator passed  
> to the signal handler isn’t attached to the model properly. I have  
> been unable to figure out why.
> 
> nikolai

–  
karfai [AT] [gmail.com](http://gmail.com)  
[http://www.strangeware.ca](http://www.strangeware.ca)  
[http://beyondtheedge.blogspot.com](http://beyondtheedge.blogspot.com)

* * *

This [SF.net](http://SF.net) email is sponsored by: Splunk Inc.  
Still grepping through log files to find problems? Stop.  
Now Search log events and configuration files using AJAX and a browser.  
Download your FREE copy of Splunk now \>\> [http://get.splunk.com/](http://get.splunk.com/)

---

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [August 24, 2007, 10:07am UTC](https://www.ruby-forum.com/t/bug-in-gtk-entrycompletion-match-selected-signal/112724/3 "2007-08-24T10:07:08Z")

</div>

On 8/22/07, Nikolai W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The attached script bombs when an entry is selected from the list of  
> completions (try entering a “T”). It seems that the iterator passed  
> to the signal handler isn’t attached to the model properly. I have  
> been unable to figure out why.

Apparently, rg2 code relies on the fact that iter-\>user\_data3 is a  
pointer to the model. I don’t know how this should be working globally  
in this case of an iter generated from a signal, there is probably the  
needs to intercept the data of the emitted signal to properly set  
user\_data3, because that’s what seems to trigger your problem  
(gtk\_tree\_model\_get\_values fired without a proper GtkTreeModel\*  
parameter); but I’ll let that to the people who designed the  
iter/user\_data3 thing.

Gtk-CRITICAL \*\*:gtk\_tree\_model\_get\_value: assertion  
`GTK\_IS\_TREE\_MODEL (tree\_model)’ failed

In the meantime, replacing iter[0] by model.get\_value(iter, 0)  
workarounds the bug.

–  
Guillaume C. - [Guillaume Cottenceau](http://zarb.org/~gc/)

* * *

This [SF.net](http://SF.net) email is sponsored by: Splunk Inc.  
Still grepping through log files to find problems? Stop.  
Now Search log events and configuration files using AJAX and a browser.  
Download your FREE copy of Splunk now \>\> [http://get.splunk.com/](http://get.splunk.com/)
