| 137 } |
137 } |
| 138 } |
138 } |
| 139 |
139 |
| 140 void uic_context_detach_document2(UiContext *ctx, void *document) { |
140 void uic_context_detach_document2(UiContext *ctx, void *document) { |
| 141 // find the document in the documents list |
141 // find the document in the documents list |
| 142 ssize_t docIndex = cxListFind(ctx->documents, document); |
142 size_t docIndex = cxListFind(ctx->documents, document); |
| 143 if(docIndex < 0) { |
143 if(!cxListIndexValid(ctx->documents, docIndex)) { |
| 144 return; |
144 return; |
| 145 } |
145 } |
| 146 |
146 |
| 147 cxListRemove(ctx->documents, docIndex); |
147 cxListRemove(ctx->documents, docIndex); |
| 148 ctx->document = cxListAt(ctx->documents, 0); |
148 ctx->document = cxListAt(ctx->documents, 0); |