]> git.saurik.com Git - wxWidgets.git/commitdiff
implemented wxNativeFontInfo::operator=() when wxUSE_PANGO, this fixes crashes when...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 21 Jul 2004 17:00:13 +0000 (17:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 21 Jul 2004 17:00:13 +0000 (17:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28357 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/fontutil.h
src/unix/fontutil.cpp

index e2243613dce52c980b8755ab45d90d5751b3dceb..56099b4758553bee6b08d20a6999be382419cad7 100644 (file)
@@ -136,9 +136,21 @@ public:
     wxNativeFontInfo() { Init(); }
 
 #if wxUSE_PANGO
-    wxNativeFontInfo(const wxNativeFontInfo& info);
-    ~wxNativeFontInfo();
-#endif
+private:
+    void Init(const wxNativeFontInfo& info);
+    void Free();
+
+public:
+    wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
+    ~wxNativeFontInfo() { Free(); }
+
+    wxNativeFontInfo& operator=(const wxNativeFontInfo& info)
+    {
+        Free();
+        Init(info);
+        return *this;
+    }
+#endif // wxUSE_PANGO
 
     // reset to the default state
     void Init();
index 79f36b31dda4c5d712a2f463931073eee97ceb30..ddbf06d0cf9388b7150b699bc0dae623229ae8ec 100644 (file)
@@ -57,7 +57,8 @@ void wxNativeFontInfo::Init()
     description = NULL;
 }
 
-wxNativeFontInfo::wxNativeFontInfo(const wxNativeFontInfo& info)
+void
+wxNativeFontInfo::Init(const wxNativeFontInfo& info)
 {
     if (info.description)
         description = pango_font_description_copy(info.description);
@@ -65,7 +66,7 @@ wxNativeFontInfo::wxNativeFontInfo(const wxNativeFontInfo& info)
         description = NULL;            
 }
 
-wxNativeFontInfo::~wxNativeFontInfo()
+wxNativeFontInfo::Free()
 {
     if (description)
         pango_font_description_free(description);