File eID-belgium-2.6.0-duplicate-qapp.patch of Package eID-belgium

--- src/belpicgui/belpicgui.cpp	2006-07-24 09:15:04.000000000 +0200
+++ ../belpicgui.cpp	2008-04-03 04:13:22.000000000 +0200
@@ -92,10 +92,19 @@
 
 static int i = 1;
 static char *s = "belpicgui";
-static QApplication gMyApp(i, &s);
+static QApplication* gMyApp = NULL;
 
 SCGUI_API scgui_ret_t scgui_init(void)
 {
+	if (!qApp)
+		gMyApp = new QApplication (i, &s);
+	return SCGUI_OK;
+}
+
+SCGUI_API scgui_ret_t scgui_finish(void)
+{
+	if (gMyApp)
+		delete gMyApp;
 	return SCGUI_OK;
 }
 #endif
--- src/newpkcs11/src/libopensc/scgui.h	2006-01-05 21:28:52.000000000 +0100
+++ ../scgui.h	2008-04-03 04:12:27.000000000 +0200
@@ -113,7 +113,8 @@
 {
 #endif
 
-typedef scgui_ret_t (*SCGUI_INIT)(void);
+typedef scgui_ret_t (*SCGUI_INIT)(void);
+typedef scgui_ret_t (*SCGUI_FINISH)(void);
 typedef scgui_ret_t (*SCGUI_ENTERPIN)(const char *, const char *, char *, int *, const char *, const char *, const char *, scgui_param_t);
 typedef scgui_ret_t (*SCGUI_CHANGEPIN)(const char *, const char *, char *, int *, char *, int *, const char *, const char *, const char *, const char *);
 typedef scgui_ret_t (*SCGUI_DISPLAY_MESSAGE)(const char *, const char *, const char *, const char *, void **, scgui_param_t, const char *);
--- src/newpkcs11/src/libopensc/card-belpic.c	2006-07-03 07:18:08.000000000 +0200
+++ ../card-belpic.c	2008-04-03 04:13:16.000000000 +0200
@@ -95,6 +95,7 @@
 #include "scgui.h"
 static void * modgui = NULL;
 static SCGUI_INIT pGuiInit = NULL;
+static SCGUI_FINISH pGuiFinish = NULL;
 static SCGUI_ENTERPIN pGuiEnterPin = NULL;
 static SCGUI_CHANGEPIN pGuiChangePin = NULL;
 static SCGUI_DISPLAY_MESSAGE pGuiDisplayMsg = NULL;
@@ -838,6 +839,9 @@
 
 static int belpic_finish(struct sc_card *card)
 {
+	if(pGuiFinish)
+		pGuiFinish();
+
 	free(DRVDATA(card));
 	return 0;
 }
@@ -965,6 +969,7 @@
     if(modgui)
     {
         pGuiInit = (SCGUI_INIT)scdl_get_address(modgui, "scgui_init");
+        pGuiFinish = (SCGUI_FINISH)scdl_get_address(modgui, "scgui_finish");
         pGuiEnterPin = (SCGUI_ENTERPIN)scdl_get_address(modgui, "scgui_enterpin");
         pGuiChangePin = (SCGUI_CHANGEPIN)scdl_get_address(modgui, "scgui_changepin");
         pGuiDisplayMsg = (SCGUI_DISPLAY_MESSAGE)scdl_get_address(modgui, "scgui_display_message");
openSUSE Build Service is sponsored by