summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-12 23:47:11 (UTC)
committer zecke <zecke>2004-09-12 23:47:11 (UTC)
commit03d8f31d45fa569d944ff635428ad9a946f077b9 (patch) (unidiff)
tree9e1bdc54778581577a16be570c133a9693b4a47d
parentf05a19bd1e248ea8cea29d361a1a8085ca145c6a (diff)
downloadopie-03d8f31d45fa569d944ff635428ad9a946f077b9.zip
opie-03d8f31d45fa569d944ff635428ad9a946f077b9.tar.gz
opie-03d8f31d45fa569d944ff635428ad9a946f077b9.tar.bz2
OColorButton::~OColorButton ( )
{ + delete d->m_menu; delete d; } That was a tricky one to find. If a dynamically loaded shared object (dso) creates QObjects/QWidgets on the destruction of QApplication they will be freed. For normal applications these dso's have already been removed from the address-space leading to calling delete to or from a bogus part of memory leading to segfaults
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libqtaux/ocolorbutton.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libqtaux/ocolorbutton.cpp b/libqtaux/ocolorbutton.cpp
index 925df7f..004fafc 100644
--- a/libqtaux/ocolorbutton.cpp
+++ b/libqtaux/ocolorbutton.cpp
@@ -44,64 +44,65 @@ struct OColorButtonPrivate
44}; 44};
45 45
46/** 46/**
47 * This concstructs a Color Button with @param color as the start color 47 * This concstructs a Color Button with @param color as the start color
48 * It'll use a OColorPopupMenu internally 48 * It'll use a OColorPopupMenu internally
49 * 49 *
50 * @param parent The parent of the Color Button 50 * @param parent The parent of the Color Button
51 * @param color The color from where to start on 51 * @param color The color from where to start on
52 * @param name @see QObject 52 * @param name @see QObject
53 */ 53 */
54OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) 54OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name )
55 : QPushButton ( parent, name ) 55 : QPushButton ( parent, name )
56{ 56{
57 d = new OColorButtonPrivate; 57 d = new OColorButtonPrivate;
58 58
59 d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); 59 d-> m_menu = new OColorPopupMenu ( color, 0, 0 );
60 setPopup ( d-> m_menu ); 60 setPopup ( d-> m_menu );
61 //setPopupDelay ( 0 ); 61 //setPopupDelay ( 0 );
62 connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&))); 62 connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&)));
63 63
64 64
65 QSize s = sizeHint ( ) + QSize ( 12, 0 ); 65 QSize s = sizeHint ( ) + QSize ( 12, 0 );
66 setMinimumSize ( s ); 66 setMinimumSize ( s );
67 setMaximumSize ( s. width ( ) * 2, s. height ( )); 67 setMaximumSize ( s. width ( ) * 2, s. height ( ));
68 d->m_color = color; 68 d->m_color = color;
69} 69}
70 70
71/** 71/**
72 * This destructs the object 72 * This destructs the object
73 */ 73 */
74OColorButton::~OColorButton ( ) 74OColorButton::~OColorButton ( )
75{ 75{
76 delete d->m_menu;
76 delete d; 77 delete d;
77} 78}
78 79
79/** 80/**
80 * @return Returns the current color of the button 81 * @return Returns the current color of the button
81 */ 82 */
82QColor OColorButton::color ( ) const 83QColor OColorButton::color ( ) const
83{ 84{
84 return d-> m_color; 85 return d-> m_color;
85} 86}
86 87
87/** 88/**
88 * This method sets the color of the button 89 * This method sets the color of the button
89 * @param c The color to be set. 90 * @param c The color to be set.
90 */ 91 */
91void OColorButton::setColor ( const QColor &c ) 92void OColorButton::setColor ( const QColor &c )
92{ 93{
93 updateColor ( c ); 94 updateColor ( c );
94} 95}
95 96
96/** 97/**
97 * @internal 98 * @internal
98 */ 99 */
99void OColorButton::updateColor ( const QColor &c ) 100void OColorButton::updateColor ( const QColor &c )
100{ 101{
101 d-> m_color = c; 102 d-> m_color = c;
102 103
103 QImage img ( width()-14, height()-6, 32 ); 104 QImage img ( width()-14, height()-6, 32 );
104 img. fill ( 0 ); 105 img. fill ( 0 );
105 106
106 int r, g, b; 107 int r, g, b;
107 c. rgb ( &r, &g, &b ); 108 c. rgb ( &r, &g, &b );