[gtkmm] #pragma pack(1) and Gtk string Segmentation Faults



In a gtkmm application I  #included a header file (written by another programmer) which contains the line:

#pragma pack(1)

When this header file is included there are various segmentation faults from the gtkmm library such as:

0x400a2b0f in Gtk::nstring::gc_str() from /usr/lib/libgtkmm-1.2.so.0

or

0x400be203 Gtk::Label::set_text() from /usr/lib/libgtkmm-1.2.so.0

whenever I used gtkmm statements involving strings such as set_title("...")

This happens on a Linux PC using gcc 2.96 .

I am aware that turning on the packing option in a compiler can cause problems with libraries.

But I can't find any documentation in the gcc man pages about  "#pragma pack(1)".

Proceeding by superstition and ignorance, I have tried modifying the header file so it reads:

namespace Tv2_ns

{

#pragma pack(1)

... various typedefs from the orginal header file

#pragma pack(0)

}

But this didn't fix the problem.

Is the following diagnosis correct:

1) gcc does recognize the pragma.  ( I notice my non-gtkmm applications run correctly and

   no alignment problems have occurred so far in the header files structures.)

2)    The segmentation faults are caused by the compiler packing the structures related to

   strings in my own code, which the library is not designed to handle.



--
Stephen Tashiro
tashiro trac wsmr army mil
tashiro zianet com
"Never let the task you are trying to accomplish
  distract you from the study of computers."






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]