Fix to allow destroying of gwin buttons

remotes/origin_old/ugfx_release_2.6
Andrew Hannam 2013-03-02 22:03:40 +10:00
parent 6ee8b005ae
commit 57435fb4c2
2 changed files with 743 additions and 741 deletions

View File

@ -108,7 +108,7 @@ bool_t geventAttachSource(GListener *pl, GSourceHandle gsh, unsigned flags) {
} }
void geventDetachSource(GListener *pl, GSourceHandle gsh) { void geventDetachSource(GListener *pl, GSourceHandle gsh) {
if (pl && gsh) { if (pl) {
chMtxLock(&geventMutex); chMtxLock(&geventMutex);
deleteAssignments(pl, gsh); deleteAssignments(pl, gsh);
if (!gsh && chSemGetCounterI(&pl->waitqueue) < 0) { if (!gsh && chSemGetCounterI(&pl->waitqueue) < 0) {

View File

@ -108,6 +108,8 @@ void gwinDestroyWindow(GHandle gh) {
gh->flags &= ~GBTN_FLG_ALLOCTXT; // To be sure, to be sure gh->flags &= ~GBTN_FLG_ALLOCTXT; // To be sure, to be sure
chHeapFree((void *)((GButtonObject *)gh)->txt); chHeapFree((void *)((GButtonObject *)gh)->txt);
} }
geventDetachSource(&((GButtonObject *)gh)->listener, 0);
geventDetachSourceListeners((GSourceHandle *)gh);
break; break;
#endif #endif
default: default: