From 0eae4ae2fc9ef417b0280257ff6ca06fa9f50978 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 17 Jun 2012 09:45:54 +0000 Subject: [PATCH] 2012-06-17 11:41 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbtip/encoder.prg * contrib/hbtip/encqp.prg % use hb_default() * contrib/hbtip/encqp.prg ! fixed RTE when using TIPEncoderQP class from a dynamically loaded hbtip. It has been reported long time ago, so now I hacked a local solution which simply removes inherition from this class, which works around the problem. Hopefully the core can get the fixes to allow derived classes to be used from dynamic libs and this can be reverted. In this case only one variable was inherited, so it was easy to do. BTW I was trying to use hb_MailAssemble() from a script which triggered this. TOFIX: Self contained example (tested on win/mingw): --- hbmk2 test.hb #require "hbtip" PROCEDURE Main() TIPEncoderBase64():New() --- -> Error BASE/3003 Cannot find super class 'TIPENCODER': __CLSINSTSUPER Called from __CLSINSTSUPER(0) Called from HBCLASS:CREATE(0) Called from TIPENCODERBASE64(0) --- --- harbour/ChangeLog | 26 ++++++++++++++++++++++++++ harbour/contrib/hbtip/encoder.prg | 8 ++------ harbour/contrib/hbtip/encqp.prg | 9 ++++++++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index baaaaaeb00..3d9e4d8b7e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,32 @@ The license applies to all entries newer than 2009-04-28. */ +2012-06-17 11:41 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbtip/encoder.prg + * contrib/hbtip/encqp.prg + % use hb_default() + + * contrib/hbtip/encqp.prg + ! fixed RTE when using TIPEncoderQP class from a dynamically loaded hbtip. + It has been reported long time ago, so now I hacked a local + solution which simply removes inherition from this class, + which works around the problem. Hopefully the core can get + the fixes to allow derived classes to be used from dynamic libs + and this can be reverted. In this case only one variable was + inherited, so it was easy to do. BTW I was trying to use hb_MailAssemble() + from a script which triggered this. + TOFIX: Self contained example (tested on win/mingw): + --- hbmk2 test.hb + #require "hbtip" + PROCEDURE Main() + TIPEncoderBase64():New() + --- -> + Error BASE/3003 Cannot find super class 'TIPENCODER': __CLSINSTSUPER + Called from __CLSINSTSUPER(0) + Called from HBCLASS:CREATE(0) + Called from TIPENCODERBASE64(0) + --- + 2012-06-17 11:23 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbtip/encqp.prg * contrib/hbtip/hbtip.hbx diff --git a/harbour/contrib/hbtip/encoder.prg b/harbour/contrib/hbtip/encoder.prg index f27e177040..21157b1900 100644 --- a/harbour/contrib/hbtip/encoder.prg +++ b/harbour/contrib/hbtip/encoder.prg @@ -65,9 +65,7 @@ FUNCTION TIp_GetEncoder( cModel ) LOCAL oEncoder - IF ! HB_ISSTRING( cModel ) - cModel := "as-is" - ENDIF + hb_default( @cModel, "as-is" ) cModel := Lower( cModel ) @@ -101,9 +99,7 @@ CREATE CLASS TIPEncoder ENDCLASS METHOD New( cModel ) CLASS TIPEncoder - IF ! HB_ISSTRING( cModel ) - cModel := "as-is" - ENDIF + hb_default( @cModel, "as-is" ) ::cName := cModel RETURN Self diff --git a/harbour/contrib/hbtip/encqp.prg b/harbour/contrib/hbtip/encqp.prg index a95c62f1cd..4df35e87d3 100644 --- a/harbour/contrib/hbtip/encqp.prg +++ b/harbour/contrib/hbtip/encqp.prg @@ -52,7 +52,14 @@ #include "hbclass.ch" -CREATE CLASS TIPEncoderQP FROM TIPEncoder +/* TOFIX: Removed TIPEncode as parent class to make it + work from a dynamically loaded hbtip library. + 'VAR cName' was the only inherited item/logic. + This should be reverted once derived classes + work fine from dynamically loaded libs. */ +CREATE CLASS TIPEncoderQP + VAR cName + METHOD New() CONSTRUCTOR METHOD Encode( cData ) METHOD Decode( cData )