]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/object.cpp
HKEY -> WXHKEY, wxScrolledWindow::SetScale added
[wxWidgets.git] / src / common / object.cpp
index 5087cf190bbc174a1de9db3392daf009f374ed9d..6f378e681076ef0717b1c55b59251776baf9b477 100644 (file)
@@ -235,8 +235,13 @@ void wxObject::StoreObject( wxObjectOutputStream& stream )
 {
   wxString obj_name = wxString(GetClassInfo()->GetClassName()) + "_Serialize";
   wxLibrary *lib = wxTheLibraries.LoadLibrary("wxserial");
-  WXSERIAL(wxObject) *serial =
-                           (WXSERIAL(wxObject) *)lib->CreateObject( obj_name );
+  WXSERIAL(wxObject) *serial;
+
+  if (!lib) {
+    wxMessageBox("Can't load wxSerial dynamic library.", "Alert !");
+    return;
+  }
+  serial = (WXSERIAL(wxObject) *)lib->CreateObject( obj_name );
 
   if (!serial) {
     wxString message;
@@ -249,6 +254,8 @@ void wxObject::StoreObject( wxObjectOutputStream& stream )
 
   serial->SetObject(this);
   serial->StoreObject(stream);
+
+  delete serial;
 }
 
 void wxObject::LoadObject( wxObjectInputStream& stream )
@@ -270,6 +277,8 @@ void wxObject::LoadObject( wxObjectInputStream& stream )
 
   serial->SetObject(this);
   serial->LoadObject(stream);
+
+  delete serial;
 }
 
 #endif