Results 1 to 5 of 5

Thread: Ice 3.2.0 migration: protected class destructors

  1. #1
    stephan is offline Registered User
    Name: Stephan Stapel
    Organization: Stephan Stapel
    Project: BristolNG
    Join Date
    Oct 2003
    Location
    Essen, Germany
    Posts
    172

    Ice 3.2.0 migration: protected class destructors

    Hi!

    I wanted to migrate one application to Ice 3.2.0. This application contains a class like this:

    Code:
    class FolderDescTree;
    sequence <FolderDescTree> FolderDescTreeSequence;
    class FolderDescTree
    {
      FolderDescTreeSequence rgChildFolders;
      FolderDesc desc;
    };
    this special class is used within a Qt application and used with the signal/slot mechanism (producing an AMI result event as introduced in ).

    Unfortunately I discovered that the class destructors were made protected in Ice 3.2.0 which breaks the compilation of the Qt moc file.

    Is there a chance to make the class destructor public (or to not-define it as it was with Ice < 3.2.0) ?

    There seems litte use to define it at all as the implementation is empty...

    regards,

    Stephan

    P.S.: On the other hand, is there another chance to implement a recursive structure but to use a class?
    Stephan Stapel
    Software Architect
    Author of 'Verteilte Internet-Anwendungen mit Ice', ix 07/2005
    Author of 'Webbasierte Anwendungen mit IcePHP', ix, 06/2006

  2. #2
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    Slice structures cannot be used recursively. In contrast to Slice classes, structs represent simple data aggregations, with no reference semantics.

    I don't understand why you require the destructor to be public. Instances of C++ classes generated from Slice classes must not be allocated on the stack. You must also not call delete on such instances. Instead, the smart pointer handles the life cycle of the heap-allocated class instance.

    Given this, I don't see how a protected destructor could break any correct Ice for C++ code. The purpose of the destructor is to have the compiler issue an error message if class instances are not properly allocated or destroyed.

  3. #3
    stephan is offline Registered User
    Name: Stephan Stapel
    Organization: Stephan Stapel
    Project: BristolNG
    Join Date
    Oct 2003
    Location
    Essen, Germany
    Posts
    172
    Hi again,

    I don't need the destructor in my own code, but in Qt's generated moc code.

    The error message is (MSVC2005):
    Code:
    .\generatedfiles\release\moc_ami_myserver_getpublicfoldertreei.cpp(67) : error C2248: 'MyApp::FolderDescTree::__vbaseDtor' : cannot access protected member declared in class 'MyApp::FolderDescTree'
    2>        e:\develop\MyApp\interfaces\folder.h(993) : compiler has generated 'MyApp::FolderDescTree::__vbaseDtor' here
    2>        e:\develop\MyApp\interfaces\folder.h(959) : see declaration of 'MyApp::FolderDescTree'
    and the corresponding moc code looks like this:

    Code:
    int AMI_MyServer_getPublicFolderTreeI::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
    {
        _id = QAmiObject::qt_metacall(_c, _id, _a);
        if (_id < 0)
            return _id;
        if (_c == QMetaObject::InvokeMetaMethod) {
            switch (_id) {
            case 0: response((*reinterpret_cast< const MyApp::FolderDescTree(*)>(_a[1]))); break;
            }
            _id -= 1;
        }
        return _id;
    }
    I marked line 67 in red which was mentioned in the compiler error output.

    the original definition was:

    Code:
    signals:
      void response(const MyApp::FolderDescTree tree);
    which follows what you introduced in the mentioned connection articles for integrating ui applications with Qt using AMI.

    do you have a suggestion or an idea how to circumvent these problems?

    Regards,

    Stephan
    Stephan Stapel
    Software Architect
    Author of 'Verteilte Internet-Anwendungen mit Ice', ix 07/2005
    Author of 'Webbasierte Anwendungen mit IcePHP', ix, 06/2006

  4. #4
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    OK, I better let the author of the article answer

  5. #5
    stephan is offline Registered User
    Name: Stephan Stapel
    Organization: Stephan Stapel
    Project: BristolNG
    Join Date
    Oct 2003
    Location
    Essen, Germany
    Posts
    172
    Sorry, I didn't see the wood for the trees. The solution is simple:

    Code:
    signals:
      void response(const MyApp::FolderDescTreePtr tree);
    and everything works well again.

    too easy

    Thanks for the smart pointer comment!

    stephan
    Stephan Stapel
    Software Architect
    Author of 'Verteilte Internet-Anwendungen mit Ice', ix 07/2005
    Author of 'Webbasierte Anwendungen mit IcePHP', ix, 06/2006

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Qeustion about ice-E object migration
    By james in forum Help Center
    Replies: 1
    Last Post: 06-20-2009, 10:55 PM
  2. Evaluating migration to ICE based infrastructure
    By grembo in forum Help Center
    Replies: 4
    Last Post: 01-21-2009, 08:14 AM
  3. Replies: 0
    Last Post: 10-10-2008, 04:15 AM
  4. IceE to Ice Migration
    By mgaris in forum Help Center
    Replies: 0
    Last Post: 12-05-2007, 12:07 PM
  5. Replies: 1
    Last Post: 11-29-2007, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •