Is impossible to preserve the GeisInstance value between functions/methods

Bug #754135 reported by José Expósito
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Geis
Fix Released
High
Stephen M. Webb

Bug Description

Hi!

I'm using utouch-geis-dev version 2.0.9 in Natty.

Now is impossible to preserve the value of GeisInstance between the methods of a class or between functions.
I'm trying to make something like this:

  GeisInstance geisInstance;

  void Class::init() {
    // [...]
    if(geis_init(&winInfo, &geisInstance) != GEIS_STATUS_SUCCESS) {
        qFatal("geis_init: Can't initialize utouch-geis");
    }
    // [...]
  }

  void Class::getGestures() {
    // [...]
    geis_event_dispatch(geisInstance);
    // [...]
  }

I also try to make a memcpy, but the definition of GeisInstance:
typedef struct _GeisInstance *GeisInstance;

Makes impossible know the size of _GeisInstance.

I don't know if this problem will have an easy solution...
Greetings!

Related branches

Revision history for this message
Stephen M. Webb (bregma) wrote :

It's not clear to me what problem you are describing. Certainly you can preserve a GeisInstance between function calls in the same way any other datum is preserved.

Attached is an example C++ program, similar to geistest, wrapping the geis API in a class, preserving the GeisInstance between member function calls.

A GeisInstance is an opaque pointer. You may copy the pointer as much as you wish, but copying the underlying object makes no more sense than copying a FILE object in the C standard IO library.

Changed in utouch-geis:
status: New → Incomplete
Revision history for this message
José Expósito (jose-exposito89) wrote :

Hello Stephen

Your example runs, but I don't why but for me crashes: Segment fault (`core' generated)

I attach a simple example. If I divide the Constructuor and the run function it crahes, but if I merge it I haven't got problems... Probably the problem should be a stupid error...

Revision history for this message
Stephen M. Webb (bregma) wrote :

Yes, the problem is in the persistence of the callback table passed to geis_subscribe().

I'll post a fix soon.

Changed in utouch-geis:
status: Incomplete → In Progress
Revision history for this message
José Expósito (jose-exposito89) wrote :

Thank you very much Stephen, you are the man!

Stephen M. Webb (bregma)
Changed in utouch-geis:
milestone: none → 2.0.11
assignee: nobody → Stephen M. Webb (bregma)
importance: Undecided → High
Stephen M. Webb (bregma)
Changed in utouch-geis:
status: In Progress → Fix Committed
Stephen M. Webb (bregma)
Changed in utouch-geis:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.