# Segmentation Fault

**URL:** <https://www.ruby-forum.com/t/segmentation-fault/193732>\
**Category:** wxRuby\
**Created:** [August 23, 2010, 4:50pm UTC](https://www.ruby-forum.com/t/segmentation-fault/193732 "2010-08-23T16:50:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 23, 2010, 4:50pm UTC](https://www.ruby-forum.com/t/segmentation-fault/193732/1 "2010-08-23T16:50:58Z")

</div>

Once more, with feeling.

I’m trying to implement using xrc\_replace so as to use a RichTextCtrl in  
a form created by FormBuilder. The problem is that I can’t even create a  
RichTextCtrl. When I try to, I get a segmentation fault.

I’ve attached the files that are causing this. I’m running wxRuby on a  
box running an up-to-date PCLinuxOS distro. I’ve stripped what I’ve  
written down to the bare essentials, the fault occurs on the  
Wx::RichTextCtrl.new(self) line in mwsnotes.rb.

The exact message I’m seeing is /usr/lib/ruby/site\_ruby/1.8/wx

```
/keyword_ctors.rb:168: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [i586-linux]

```

Thanks in advance.  
—Michael

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 24, 2010, 6:59am UTC](https://www.ruby-forum.com/t/segmentation-fault/193732/2 "2010-08-24T06:59:37Z")

</div>

Hey Michael,

Try creating the RichText Control, with  
Wx::TextCtrl.new(self,:style=\>Wx::TE\_MULTILINE|Wx::TE\_RICH). I’ve never  
had  
the ability to use the Wx::RichTextCtrl class directly, but using the  
above  
method, works perfectly fine, and has never failed on me.

hth,

Mario

On Mon, Aug 23, 2010 at 10:50 AM, Michael S.

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 24, 2010, 4:39pm UTC](https://www.ruby-forum.com/t/segmentation-fault/193732/3 "2010-08-24T16:39:22Z")

</div>

Mario S. wrote:

> Hey Michael,
> 
> Try creating the RichText Control, with  
> Wx::TextCtrl.new(self,:style=\>Wx::TE\_MULTILINE|Wx::TE\_RICH). I’ve never  
> had  
> the ability to use the Wx::RichTextCtrl class directly, but using the  
> above  
> method, works perfectly fine, and has never failed on me.
> 
> hth,
> 
> Mario
> 
> On Mon, Aug 23, 2010 at 10:50 AM, Michael S.

That probably works great under Windoze, but it’s ignored under other  
platforms. I’m developing on PCLinuxOS.

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 25, 2010, 1:18am UTC](https://www.ruby-forum.com/t/segmentation-fault/193732/4 "2010-08-25T01:18:42Z")

</div>

Hey Michael,

On Tue, Aug 24, 2010 at 10:39 AM, Michael S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> > hth,
> > 
> > Mario
> > 
> > On Mon, Aug 23, 2010 at 10:50 AM, Michael S.
> 
> That probably works great under Windoze, but it’s ignored under other  
> platforms. I’m developing on PCLinuxOS.

I develop for Ubuntu / Mac OS X, and have always used that incarnation  
to  
create a RichText Control, and has always come out to be a RichText  
Control.  
It is universal, and works on all 3 platforms, so I don’t see why it  
wouldn’t work.

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 25, 2010, 5:43am UTC](https://www.ruby-forum.com/t/segmentation-fault/193732/5 "2010-08-25T05:43:15Z")

</div>

Mario S. wrote:

> I develop for Ubuntu / Mac OS X, and have always used that incarnation  
> to  
> create a RichText Control, and has always come out to be a RichText  
> Control.  
> It is universal, and works on all 3 platforms, so I don’t see why it  
> wouldn’t work.

My fault, and it is a perfect example of Satterwhite’s Observation on  
Life #2: “In any situation in which theory conflicts with reality,  
reality wins hands down.”

I was basing my reply on the documentation of style TE\_RICH: “Use rich  
text control under Win32, this allows to have more than 64KB of text in  
the control even under Win9x. This style is ignored under other  
platforms.” That was the theory. You’re telling me what the reality is  
based on experience - that it works well under the other platforms. I  
should have known better.

Thanks much. I’ll try this.
