X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f2be1259350586411e21c84024967408eef6280..86470d432f52318dfaac17bfd6cf41e5123e82c9:/src/common/rendcmn.cpp diff --git a/src/common/rendcmn.cpp b/src/common/rendcmn.cpp index 77bfdde516..2cedd7f4de 100644 --- a/src/common/rendcmn.cpp +++ b/src/common/rendcmn.cpp @@ -25,6 +25,8 @@ #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/log.h" + #include "wx/intl.h" #endif //WX_PRECOMP #include "wx/apptrait.h" @@ -83,6 +85,9 @@ private: bool m_initialized; + // just to suppress a gcc warning + friend class wxRendererPtrDummyFriend; + DECLARE_NO_COPY_CLASS(wxRendererPtr) }; @@ -123,6 +128,11 @@ private: // wxRendererNative implementation // ============================================================================ +wxRendererNative::~wxRendererNative() +{ + // empty but necessary +} + // ---------------------------------------------------------------------------- // Managing the global renderer // ---------------------------------------------------------------------------- @@ -171,10 +181,24 @@ wxRendererNative *wxRendererNative::Load(const wxString& name) if ( !pfnwxCreateRenderer ) return NULL; + // create a renderer object wxRendererNative *renderer = (*pfnwxCreateRenderer)(); if ( !renderer ) return NULL; + // check that its version is compatible with ours + wxRendererVersion ver = renderer->GetVersion(); + if ( !wxRendererVersion::IsCompatible(ver) ) + { + wxLogError(_("Renderer \"%s\" has incompatible version %d.%d and couldn't be loaded."), + name.c_str(), ver.version, ver.age); + delete renderer; + + return NULL; + } + + // finally wrap the renderer in an object which will delete it and unload + // the library when it is deleted and return it to the caller return new wxRendererFromDynLib(dll, renderer); }